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

Simple CMakeLists.txt #1041

Closed
vsoch opened this issue Nov 22, 2022 · 4 comments
Closed

Simple CMakeLists.txt #1041

vsoch opened this issue Nov 22, 2022 · 4 comments

Comments

@vsoch
Copy link

vsoch commented Nov 22, 2022

Hi! I'm looking to build this with nix, and the way you have the custom install (running the bash script) is not ideal (it largely won't work). Can you share the most vanilla method to get this built with a standard cmake command? Apologies I'm not a heavy cmake user so I don't really know how it works. Thanks!

@cyrush
Copy link
Member

cyrush commented Nov 22, 2022

Sure thing, our github actions for windows CI setup seems like a a good example:

cmake -S src -B build `

If you want to enable more features, you can pass them with cmake args like:

-DHDF5_DIR=path/to/hdf5/install

Here is a list of the options (which I should convert to a table to make them easier to read!)

https://llnl-conduit.readthedocs.io/en/latest/building.html#build-options

@vsoch
Copy link
Author

vsoch commented Nov 22, 2022

Ah that's perfect - I'll keep this bookmarked! I wound up using a trick to cd into the src directory first, and then nix makes the build directory there and the ../ points to where it needs to be. And I think I got most of the basics with respect to flags https://github.com/rse-ops/nix/blob/0405825e4ff284e0e937c60baa78d2cbfa3c7e7a/pkgs/hpc/conduit/default.nix#L80-L92 and the bug I ran into was that when MPI was turned on, I think (blt?) couldn't find a bunch of symbols, telling me that one of those extra options was missing for it. I noticed that spack uses the tarball with blt so I am following suit, and I think my bug in building with MPI is that I need to possibly add more paths for it? E.g., there is quite a bit of logic here! https://github.com/spack/spack/blob/4bf964e6b36e8756b014c2e30343507c1cb71b03/var/spack/repos/builtin/packages/conduit/package.py#L468.

I got the basic build working (without MPI) and I'm hoping to go back to it and have MPI work too - I'm just kind of terrible with Cmake and new to Nix! 😆

@cyrush
Copy link
Member

cyrush commented Nov 22, 2022

Glad that helped!

For MPI, the best path is to set cmake opts:

-DMPI_C_COMPILER=zzz
-DMPI_CXX_COMPILER=zzz
-DMPI_Fortran_COMPILER=zzz

to point to the MPI compiler wrappers (from mpich, etc)

The other case (usually on cray systems) is when you use compiler wrappers as the main compiler.
You pass the cray or mpi compiler wrapper to cmake as CMAKE_C_COMPILER (etc) instead of MPI_C_COMPILER (etc).

In this case you want ENABLE_FIND_MPI to be off. That tells cmake to "trust me, mpi exists but don't look for it!"

@vsoch
Copy link
Author

vsoch commented Nov 22, 2022

Thank you! I've made a note in our repository and we are good to close here - I think this will mostly be me figuring out how nix achieves the same ability to get a prefix / etc for a package. I'll come back in the future if I have another question. Thanks for your help!

@vsoch vsoch closed this as completed Nov 22, 2022
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