38 for (
int i = 0; i < MAX; i++)
41 auto* data_ptr = foo->data;
43 PRAGMA_OFFLOAD(
"omp target enter data map(alloc:foo[0:1])")
44 PRAGMA_OFFLOAD(
"omp target map(always, to: foo[0:1], data_ptr[0:foo->size])") { foo->data = data_ptr; }
47 double check_data1(0);
48 void* check_address1(
nullptr);
49 void* check_address2(
nullptr);
50 void* check_address3(
nullptr);
52 PRAGMA_OFFLOAD(
"omp target teams num_teams(1) \ 53 map(from: check_size, check_data1, check_address1, check_address2, check_address3)")
56 check_size = foo->size;
57 check_data1 = foo->data[1];
58 check_address1 = data_ptr;
59 check_address2 = foo->data;
63 std::cout <<
"foo->data value on the host " << foo->data << std::endl;
64 std::cout <<
"foo->data value on the device " << check_address2 << std::endl;
65 std::cout <<
"foo->data mapped address on the device " << check_address1 << std::endl;
66 std::cout <<
"foo value on the host " << foo << std::endl;
67 std::cout <<
"foo mapped address on the device " << check_address3 << std::endl;
72 PRAGMA_OFFLOAD(
"omp target teams num_teams(1) map(always,from:data_ptr[0:foo->size])") { data_ptr[1] = 2; }
77 PRAGMA_OFFLOAD(
"omp target exit data map(delete:foo[0:1])")
helper functions for EinsplineSetBuilder
void deallocate(value_type *pt, std::size_t n)
TEST_CASE("complex_helper", "[type_traits]")
REQUIRE(std::filesystem::exists(filename))
OMPallocator is an allocator with fused device and dualspace allocator functionality.
value_type * allocate(std::size_t n)