| 157 | } |
| 158 | |
| 159 | void 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 | |
| 184 | void test_release_gpu_device_resized_smaller () |
| 185 | { |
no test coverage detected