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

Fix target_link_libraries calls w/ alias target #147

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nmnobre
Copy link
Contributor

@nmnobre nmnobre commented Dec 17, 2024

Hey @ax3l, @atmyers, @WeiqunZhang,

I think the guided tutorials are no longer building?
Feel free to edit with a better/shorter fix. :)

Cheers,
-Nuno

@WeiqunZhang
Copy link
Member

It seems to build for me. What issues do you see?

$ amrex-tutorials/GuidedTutorials/HelloWorld/
$ mkdir build
$ cd build
$ cmake ..
$ mpiexec -n 4 ./HelloWorld
Initializing AMReX (24.12-14-gb3f67385e62f)...
MPI initialized with 4 MPI processes
MPI initialized with thread support level 0
AMReX (24.12-14-gb3f67385e62f) initialized
Hello world from AMReX version 24.12-14-gb3f67385e62f
AMReX (24.12-14-gb3f67385e62f) finalized

@WeiqunZhang
Copy link
Member

I am using

commit 51fabc1563c3949a364e1a091d2632d4974662a8 (HEAD -> main, origin/main, origin/HEAD)
Merge: ffbfc5a d261a37
Author: Andy Nonaka <[email protected]>
Date:   Thu Dec 19 13:01:35 2024 -0800

    Merge pull request #148 from ajnonaka/main
    
    Add 2d to basic fft tutorial

@nmnobre
Copy link
Contributor Author

nmnobre commented Dec 20, 2024

I can't tell from your input/output for certain, but make sure CMake is not downloading AMReX and that you're using an existing AMReX installation with -DAMReX_ROOT=..., in which case you should see:

CMake Error at CMakeLists.txt:70 (target_link_libraries):
  target_link_libraries can not be used on an ALIAS target.

@WeiqunZhang
Copy link
Member

I see. Let me try again later today.

@nmnobre
Copy link
Contributor Author

nmnobre commented Jan 10, 2025

Rebased to remove the updates to the CI workflows to install {cu,roc}SPARSE since @ajnonaka leapfrogged me. :)

Comment on lines 74 to 75
get_target_property(AMReX_ALIASED AMReX::amrex ALIASED_TARGET)
target_link_libraries(${AMReX_ALIASED} INTERFACE ${MPI_LIBRARIES})
Copy link
Member

@ax3l ax3l Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the tutorials have a specific dimensionality?

AMReX::amrex is for backwards compatibility and refers to the last-built spacedim (before, we could only build one -- keeping this target name around made transitions non-breaking/easier). But we have explicit AMReX::amrex_1d/AMReX::amrex_2d/AMReX::amrex_3d targets that we should now use.
https://github.com/AMReX-Codes/amrex/blob/041f225dc5c97a5e3baf2559046ceabffd75f002/Src/CMakeLists.txt#L8-L15

@@ -63,7 +63,8 @@ else()

# Add mpi
find_package(MPI REQUIRED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny that we need MPI here at all, because if we need MPI, AMReX has to be built with MPI, which means MPI is already linked as a public transitive dependency in the AMReX::amrex_*d targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMReX has to be built with MPI

Should we check for that? Or because we don't necessarily need MPI, do we just go with whatever the AMReX pkg we find already has (or has not)?

Transitive already in AMReX
@ax3l ax3l added the bug Something isn't working label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants