Skip to content

Conversation

@pbartholomew08
Copy link
Member

Closes #178

Currently the backend is fixed based on the compiler. As we add backends the user should be able to select between them, for example currently we could have

NVHPC: CUDA/GPU or OMP/CPU
Other: OMP/CPU

@pbartholomew08 pbartholomew08 self-assigned this May 5, 2025
@semi-h
Copy link
Member

semi-h commented May 6, 2025

I think it'll be better to specify the backend at runtime rather than at compile time. Right now we don't have this functionality but it is trivial to add this in the main xcompact.f90 file (For example "mpirun -np 2 x3d2 --backend cuda input.x3d"). Runtime specification of backend is the only way to allow heterogeneous runs, and we can't rely on CMake level decisions for heterogeneous runs ("mpirun -np 1 x3d2 --backend cuda input.x3d : -np 1 x3d2 --backend omp input.x3d2" so that one rank runs on CPU and the other on GPU, and for this we need both backend/omp and backend/cuda to be compiled and available). Also for example with the current CUDA compilers we run the OpenMP backend unit tests as well, it wouldn't be possible if we omitted OpenMP backend source files by specifying CUDA backend at compile time.

So the idea is from the CMake we allow the present compiler to compile all the parts of the codebase it can, then at runtime we decide which specific backend we want to go ahead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable user selection of backend

2 participants