Add 'make test' target to build and run correctness tests#19
Conversation
Add a top-level `test` target that builds the library and the test programs against it, then runs the GPU-vs-CPU correctness tests for the 4th-order, GRAPE5 (2nd-order) and 6th-order integrators. The target dispatches to the CUDA or OpenCL test Makefile based on the selected BACKEND, and sets LD_LIBRARY_PATH so the freshly built shared libraries are found at runtime. A `build-tests` target is also provided to compile the tests without running them, and `clean` now also cleans the tests directory. Fix two pre-existing bugs in tests/Makefile_ocl that prevented the OpenCL tests from building/running: link against libsapporo2 (not the old libsapporo name) and symlink kernels from src/OpenCL. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The objects and libsapporo2 are backend-specific (CUDA compiles cudadev.h, OpenCL compiles ocldev.h via -D_OCL_), but Make only tracks file timestamps, not the value of BACKEND. After building one backend, a subsequent build with the other silently reused the existing objects, so e.g. an OpenCL test linked against a CUDA-compiled libsapporo2 and aborted with CUDA_ERROR_INVALID_IMAGE in cudadev.h when cuModuleLoad() was handed a .cl source file. Record the active backend in a stamp file that the objects depend on, forcing a recompile when BACKEND changes while keeping same-backend rebuilds incremental. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Some progress report on this. Commit c1292cb completes both
when running Commit 2bcbd49 does not fix that error, so I reverted it (locally). |
|
On a different machine, with NVIDIA GPU and CUDA 13.1, after branching off master and |
|
My AI tool insists that this error occurs because OpenCL packages have not been installed completely and/or my environment is not setup to point to the OpenCL libraries. Indeed, I could bypass that error through |
|
Right, that one was fixed by claude by temporarily patching the code and setting the Opencl target to CPU, it is hardcoded somewhere to be GPU, and pocl is a cpu-library... |
|
I also added My AI tool (GH Copilot) suggests that I should install an OpenCL runtime for my hardware (AMD CPU, NVIDIA GPU). |
|
With a fresh Python 3.14 Conda env and everything fresh: Invalid work group size is something that has to do with the code, not with with my env. And it is using |
Got that fixed to use my GPU and it runs at 100% utilisation. Unfortunately, it is still running, way longer than with the CUDA backend (2s or so). |
Add a top-level
testtarget that builds the library and the test programs against it, then runs the GPU-vs-CPU correctness tests for the 4th-order, GRAPE5 (2nd-order) and 6th-order integrators. The target dispatches to the CUDA or OpenCL test Makefile based on the selected BACKEND, and sets LD_LIBRARY_PATH so the freshly built shared libraries are found at runtime. Abuild-teststarget is also provided to compile the tests without running them, andcleannow also cleans the tests directory.Fix two pre-existing bugs in tests/Makefile_ocl that prevented the OpenCL tests from building/running: link against libsapporo2 (not the old libsapporo name) and symlink kernels from src/OpenCL.