Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake target for each accelerator #1019

Open
psychocoderHPC opened this issue May 29, 2020 · 9 comments
Open

CMake target for each accelerator #1019

psychocoderHPC opened this issue May 29, 2020 · 9 comments

Comments

@psychocoderHPC
Copy link
Member

Based on this I suggest that we add CMake target for each accelerator backend.
Currently alpaka CMake behaves to optimal fits the CI workflow and is activating all available backends.
Backends should be select able during the install of alpaka and store the dependencies including there locations. After alpaka is installed e.g. for CUDA than there is no requirement to search for a CUDA library again because dependencies must be checked during the install or when add_subdirectory is called.

@j-stephan
Copy link
Member

j-stephan commented May 29, 2020

After alpaka is installed e.g. for CUDA than there is no requirement to search for a CUDA library again because dependencies must be checked during the install or when add_subdirectory is called.

What if I don't have CUDA installed at first but install it after alpaka? Do we want to force a reinstall?

@psychocoderHPC
Copy link
Member Author

Than you can not use CUDA. If you install MPI before you install CUDA you can not have a CUDA-aware MPI.
If you activate CUDA after you installed alpaka you can not guarantee that you alpaka works fine with CUDA.
The general workflow to install software is:

- configure
- make
- make test
- make install

To switch the CUDA version after installing alpaka sound good but will avoid that you are on a reproducible environment.

@psychocoderHPC
Copy link
Member Author

You sill have the possibility to use alpaka via add_subdirectory to be able to switch accelerator backends.

@j-stephan
Copy link
Member

But CUDA is a build dependency for CUDA-aware MPI, right? This isn't true for alpaka since we are header-only.

I'm also not convinced that there is a problem with our current approach. Right now we check for dependencies at build / installation / add_subdirectory as well as find_package (i.e. after installing alpaka). The latter comes with virtually no overhead. Why should we remove it?

@psychocoderHPC
Copy link
Member Author

psychocoderHPC commented May 29, 2020 via email

@psychocoderHPC
Copy link
Member Author

A possible way would be to keep the live search in cmake after the installation but only allow backends those was activated and therefore could be tested during the install and disable all other.
This would still allow you to switch e.g. between different cuda versions if cuda was enabled during the install.

@ax3l
Copy link
Member

ax3l commented May 29, 2020

You both have great points and I think keeping the installed version as @j-stephan describes agnostic is quite good, especially for other package managers than Spack that live with a more "runtime addon" philosophy (debian, conda-forge et al.).

The point that @psychocoderHPC raises is really good and I would say we could address this with:

  • additional documentation how to test backends at install-time (mainly for sysadmins and packagers)
  • additional, small test integration tests that we install into $PREFIX/shared/alpaka/examples/ that can be built to test an installed alpaka with mini-examples against various, pre-selected backends

@SimeonEhrig
Copy link
Member

I agree with @psychocoderHPC that we should not activate all possible backends by default. It is not the usual workflow and it is a source of unnecessary bugs (e.g. In my case, OpenMP and the nvcc together caused a problem and did not use OpenMP in my code).
But I think we should not restrict the backends at install time without a technical reason. How @ax3l already mention, there are workflows, which allows to extend the environment during the development.

@j-stephan
Copy link
Member

@SimeonEhrig has unconvered a problem with the current approach while working on vikunja. Currently we don't use CMake's install(EXPORT ...) functionality. This means that the alpaka target is not known to CMake's installation routines and we end up with a FindAlpaka.cmake that basically works as a slightly different CMakeLists.txt. While this has the benefit of being able to reconfigure alpaka after installing it, third-party libraries depending on alpaka cannot be installed anymore if they use install(EXPORT):

CMake Error: install(EXPORT "vikunjaTargets" ...) includes target "vikunja" which requires target "alpaka" that is not in any export set.

I believe we could fix this by using install(EXPORT) in alpaka's CMakeLists.txt. This will make the alpaka target known to the installation procedure and generate a FindAlpaka.cmake that has a fixed set of compiler and linker flags, definitions, include directories, libraries - so alpaka won't be reconfigurable after installation (except by reinstallation).

Unless there are any objections I'd start working on that in the coming days.

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

No branches or pull requests

4 participants