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

Using cupla alongside mallocMC #198

Open
frobnitzem opened this issue Mar 13, 2021 · 2 comments
Open

Using cupla alongside mallocMC #198

frobnitzem opened this issue Mar 13, 2021 · 2 comments

Comments

@frobnitzem
Copy link

I am trying to create a new project with both of the above as submodules. In https://github.com/frobnitzem/FastParticleToolkit I basically replicated the structure of ComputationalRadiationPhysics/picongpu, but left out PMacc. Something got lost in translation with the include/fpt/CMakeLists.txt though, since I always get some variant of:

CMake Error at $HOME/FastParticleToolkit/thirdParty/mallocMC/alpaka/CMakeLists.txt:108 (add_custom_target):
  add_custom_target cannot create target "alpakaIde" because another target
  with the same name already exists.  The existing target is a custom target
  created in source directory
  "$HOME/FastParticleToolkit/include/fpt".  See
  documentation for policy CMP0002 for more details.

-- Found mallocMC: $HOME/FastParticleToolkit/thirdParty/mallocMC/src (found suitable version "2.6.0", minimum required is "2.3.0")  

It seems the issue is that cupla links to alpaka and defines alpakaIde first. Then, mallocMC tries the same trick and fails. I can't set mallocMC to "use external alpaka" since the 2 alpaka versions are different. So I have too many alpakas.

code:

git clone --recursive https://github.com/frobnitzem/FastParticleToolkit
FastParticleToolkit/bin/FPT-create.sh experiment
cd experiment
../FastParticleToolkit/bin/FPT-build.sh
@sbastrakov
Copy link
Member

sbastrakov commented Mar 15, 2021

Thanks for reporting @frobnitzem .

It should be possible to tell mallocMC to use an external version of alpaka. It defines a property mallocMC_ALPAKA_PROVIDER to switch between its internally shipped alpaka version and an external user-provided one. So you could use that external mechanism to make mallocMC use the "right" version for your setup.

We follow this external scheme in PMacc, I believe in a hacky way, here. Perhaps this would work for you as well?

Btw cupla has a similar mechanism in cupla_ALPAKA_PROVIDER for the same reason. So you could set one of malloMC or cupla to use alpaka from the other, or set both to use the same external alpaka. Generally, cupla is more picky in what alpaka version it accepts (as it's a direct interface adapter of alpaka).

@psychocoderHPC
Copy link
Member

As @sbastrakov said settingmallocMC_ALPAKA_PROVIDER should work. In picongpu we still use a very old cmake find module for mallocMC
In general, it should be possible to use mallocMC without this find module, this is something I would try to do. For modern CMake there is no need anymore to provide a find module, this is an old leftover from CMake times before CMake targets.

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

3 participants