MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / test_release_gpu_device_cleared

Function test_release_gpu_device_cleared

Tests/Base/TrackedVector/main.cpp:159–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

157}
158
159void test_release_gpu_device_cleared ()
160{
161 // Device is authoritatively shrunk to zero, then release_gpu() must
162 // preserve that state on the host before freeing device storage.
163 TVec v;
164 v.host().assign({5, 6, 7});
165 verify_host_device_match(v);
166
167 clear_device_vector(v);
168#ifdef AMREX_USE_GPU
169 AMREX_ALWAYS_ASSERT(v.status() == Status::device_dirty);
170#endif
171
172 v.release_gpu();
173#ifdef AMREX_USE_GPU
174 AMREX_ALWAYS_ASSERT(v.status() == Status::host_dirty);
175#else
176 AMREX_ALWAYS_ASSERT(v.status() == Status::up_to_date);
177#endif
178 AMREX_ALWAYS_ASSERT(v.host_const().empty());
179
180 // An empty authoritative device state must still round-trip cleanly.
181 verify_host_device_match(v);
182}
183
184void test_release_gpu_device_resized_smaller ()
185{

Callers 1

Calls 6

verify_host_device_matchFunction · 0.85
clear_device_vectorFunction · 0.85
statusMethod · 0.80
release_gpuMethod · 0.80
assignMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected