ExCALIBUR-NEPTUNE / NESO

MIT License
4 stars 4 forks source link

1D1V Buffer compilance #171

Open will-saunders-ukaea opened 1 year ago

will-saunders-ukaea commented 1 year ago

The TwoStream and FFT tests - Essentially any tests where host arrays are modified directly rather than using a host accessor (which is all of them).

What NESO (the original 1D1V code) does is create std::vectors then create buffer member variables using the std::vector::data pointers (e.g. this one [1]). These buffers then have the same lifetime as the object. Tests modify data in the original vector directly not via a buffer host accessor.

However the Buffer spec says "The ownership of this memory is given to the constructed SYCL buffer for the duration of its lifetime.". Hence when we modify the original vector directly this is non-compliant. The SYCL implementation doesn't see these writes and hence doesn't copy the new values to the device - hence the test fails when the buffer memory is separate from the host memory e.g. on the GPU.

[1] https://github.com/ExCALIBUR-NEPTUNE/NESO/blob/b8a75f7804c66494049614d195578428b6077d26/include/mesh.hpp#L54