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

AMReX tutorials cmake fails #48

Open
ramsampath opened this issue Feb 7, 2022 · 1 comment
Open

AMReX tutorials cmake fails #48

ramsampath opened this issue Feb 7, 2022 · 1 comment

Comments

@ramsampath
Copy link

I built AMReX successfully with CUDA support on Ubuntu 20 with gcc 9.3 , however when I use cmake to build the tutorials

I get the following cmake errors
CMake Error at /home/ram/Documents/Software/amrex/installdir/Tools/CMake/AMReX_SetupCUDA.cmake:36 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
/home/ram/Documents/Software/amrex/installdir/lib/cmake/AMReX/AMReXConfig.cmake:235 (include)
CMakeLists.txt:65 (find_package)

CMake Error at /home/ram/Documents/Software/amrex/installdir/Tools/CMake/AMReX_SetupCUDA.cmake:37 (get_filename_component):
get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
/home/ram/Documents/Software/amrex/installdir/lib/cmake/AMReX/AMReXConfig.cmake:235 (include)
CMakeLists.txt:65 (find_package)

The CUDA compiler identification is NVIDIA 11.2.152
Check for working CUDA compiler: /usr/local/cuda-11.2/bin/nvcc
Check for working CUDA compiler: /usr/local/cuda-11.2/bin/nvcc -- works
Detecting CUDA compiler ABI info
Detecting CUDA compiler ABI info - done
Base Name:
Base Name: Advection_AmrCore
Executable name: Advection_AmrCore
CMake Error at cmake/SetupTutorials.cmake:61 (setup_target_for_cuda_compilation):
Unknown CMake command "setup_target_for_cuda_compilation".
Call Stack (most recent call first):
Amr/Advection_AmrCore/CMakeLists.txt:16 (setup_tutorial)

  • would be great if someone could guide through this.

Thank you
Ram.

@etpalmer63
Copy link
Collaborator

Hey Ram, sorry for the slow response. I need to fix my notifications for messages posted here.

As you may have noticed the tutorials are split into GuidedTutorials and ExampleCodes. With CMake GuidedTutorials can be compiled individually. The ExampleCodes are compiled all together.

To compile the example codes with CMake ( Since it looks like you're after Advection_AmrCore) do the following:

  • Navigate to the folder amrex-tutorials/ExampleCodes.
  • Make a build directory and enter it. (i.e. amrex_tutorials/ExampleCodes/build)
  • Type cmake .. , to tell cmake to configure the build according to the CMakeLists.txt in the parent directory.
  • After that finishes, type cmake --build . -j8 (-j8 tells it 8 parallel jobs, adjust to your application) . This will build several of the examples, including building Advection_AmrCore.
  • You will then be able to run, by going to amrex_tutorials/ExampleCodes/build/Amr/Advection_AmrCore and calling the executable with and inputs file: ./Advection_AmrCore inputs.

If you want to enable Cuda GPU, everything is the same except for the CMake configure step. On that step type,
cmake .. -DAMReX_GPU_BACKEND=CUDA instead of just cmake ...

If the GPU runs properly you'll see a short message before AMReX finalized the describes the GPU memory usage during the run.

Again, sorry for the slow response. Thanks for your interest!

Erik

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

No branches or pull requests

2 participants