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 refactor #225

Merged
merged 17 commits into from
Apr 17, 2024
Merged

cmake refactor #225

merged 17 commits into from
Apr 17, 2024

Conversation

seimtpow
Copy link
Contributor

Description

Updating cmake to use updated neso-particles (now consumed as submodule) + some other minor updates
added AdaptiveCPP and IntelSYCL as options in FindSYCL
fixed some deprecated code that fails to compile with new intel compiler
updated neso-particles submodule to point to compatible version.

Updated neso-particles submodule

Changed the FindSYCL.cmake to be a macro
    - Can request specific sycl implementation
    - looks for intel sycl if intel compilers beign used
    - adaptiveCPP/hipsycl otherwise

Removed some using namespace std and added "std::"s where needed

Using the neso-particles find restrict code in NESO - I don't like this
would a header file + some pre-processing be better instead of (or in addition to) this
  - My main objection is that if neso-particles is installed, then you
    can't export the RESTRICT keyword you found as part of the
    neso-particles target as (in theory) you might compile in the
    consuming project with a different compiler that doesn't have the
    same keyword.
@will-saunders-ukaea
Copy link
Contributor

These fixes for the namespace std includes fix the compiling issues we have been seeing with gcc 11.3.0, 11.4.0 and gcc 12.3.0. (Apparently Nektar saw this as well and a stray "using namespace std" was the cause).

@seimtpow
Copy link
Contributor Author

seimtpow commented Mar 7, 2024

These fixes for the namespace std includes fix the compiling issues we have been seeing with gcc 11.3.0, 11.4.0 and gcc 12.3.0. (Apparently Nektar saw this as well and a stray "using namespace std" was the cause)

We should probably remove all the using namespace <whatever> in all the headers at some point and then ban it.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
Seimon added 2 commits March 7, 2024 18:42
Simplfy SYCL.cmake

Stop setting HIPSYCL_TARGET etc

update submodule
@jwscook
Copy link
Member

jwscook commented Apr 10, 2024

@cmacmackin would you mind reviewing this and merging if acceptable please?

@cmacmackin
Copy link
Contributor

Sorry for not doing this earlier. There kept being new commits pushed so I wasn't sure when it was actually ready.

Copy link
Contributor

@cmacmackin cmacmackin left a comment

Choose a reason for hiding this comment

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

When I tried building this I got this error again:

   The link interface of target "hdf5-shared" contains:

    MPI::MPI_C

  but the target was not found.  Possible reasons include:

I addressed this in ExCALIBUR-NEPTUNE/NESO-Particles#47 but it seems to have been lost in @seimtpow refactoring.

@oparry-ukaea oparry-ukaea added this to the neso-hw-impurity-transport milestone Apr 11, 2024
Copy link
Contributor

@cmacmackin cmacmackin left a comment

Choose a reason for hiding this comment

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

I've made some changes necessary to make everything build on my system (plus address a flaw I noticed). It's probably worth @will-saunders-ukaea or @oparry-ukaea checking everything still builds for them. Might also be best to wait until ExCALIBUR-NEPTUNE/NESO-Particles#64 is merged.

@oparry-ukaea oparry-ukaea removed this from the neso-hw-impurity-transport milestone Apr 12, 2024
@oparry-ukaea
Copy link
Contributor

Shall I merge main into this, resolve the conflict with solvers/SimpleSOL/EquationSystems/SOLWithParticlesSystem.cpp and make sure it builds for me?

@oparry-ukaea
Copy link
Contributor

I get

CMake Error at CMakeLists.txt:240 (target_link_libraries):
  Target "nesolib" links to:

    NESO-Particles::NESO-Particles
when configuring
  but the target was not found.  Possible reasons include:
...

(before merging from main, and having run git submodule update --init)

@cmacmackin
Copy link
Contributor

Could you send me your spack-build-01-cmake-out.txt file please?

@oparry-ukaea
Copy link
Contributor

@cmacmackin
Copy link
Contributor

spack-build-01-cmake-out.txt

That looks like it ran successfully. I'm not seeing any errors about failing to find NESO-Particles.

@oparry-ukaea
Copy link
Contributor

oparry-ukaea commented Apr 12, 2024

That looks like it ran successfully. I'm not seeing any errors about failing to find NESO-Particles.

Sorry, was configuring with
spack build-env neso%gcc cmake -B ...
so that log file wasn't relevant, plus I hadn't re-spack-installed NESO-Particles ... 🤦‍♂️

Builds with gcc for me, with Will's latest changes plus merge from main
Trying oneapi now, but I assume that'll be fine

@will-saunders-ukaea
Copy link
Contributor

will-saunders-ukaea commented Apr 12, 2024

Right my understanding is that @seimtpow is doing a cleanup of the NP cmake that should not change functionality. Then we can look to actually merge.

Edit: I propose that this is last addition to avoid feature creep and if there are any outstanding changes then they are added just before we do a v0.1.0 of NESO. I'm expecting to make a release of NP to coincide with v0.1.0 of NESO and that will be the submodule commit of NP in NESO for the release.

@oparry-ukaea
Copy link
Contributor

Builds with oneapi for me too

@cmacmackin
Copy link
Contributor

Are we ready to merge now?

@will-saunders-ukaea
Copy link
Contributor

Are we ready to merge now?

It builds with gcc for me. I should do a intel build as well.

@oparry-ukaea
Copy link
Contributor

Latest version builds with gcc and intel for me

@will-saunders-ukaea
Copy link
Contributor

hipsycl cuda-nvcxx built and passed for me.

@will-saunders-ukaea
Copy link
Contributor

will-saunders-ukaea commented Apr 15, 2024

Seeing this with oneapi@2022.1.0:

     166     [ 50%] Building CXX object test/CMakeFiles/unitTests.dir/unit/test_species.cpp.o
     167     cd /home/js0259/git-ukaea/NESO/spack-build-wdij2ez/test && /home/js0259/git/spack-v0.21/lib/spack/env/oneapi/icpx -DBOOST_HAS_NUMPY -DGTEST_LINKED_AS_SHARED_LIB
             RARY=1 -DH5_BUILT_AS_DYNAMIC_LIB -DNEKTAR_MEMORY_POOL_ENABLED -DNEKTAR_USE_MPI -pthread -DNEKTAR_USE_MPI -DNEKTAR_USE_SCOTCH -DNEKTAR_USE_THREAD_SAFETY -DNESO_I
             NTEL_MKL_FFT -DNESO_PARTICLES_DEVICE_TYPE_CPU -DNESO_PARTICLES_HDF5 -DRESTRICT=__restrict -DTIXML_USE_STL -DWITH_PYTHON -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_
             LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200809L -I/home/js0259/git-ukaea/NESO/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/o
             neapi-2022.1.0/nektar-5.2.0-2022-09-03-fhauyh54iyvpvb4m7rsvxnx5gze3jqyg/include/nektar++ -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/intel-2021.6.0/
             boost-1.83.0-s3rnueon7odwb3ltlvhokhrctnmzsnfa/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/tinyxml-2.6.2-4mtob5q4ynkukm3wfzfy
             lo6262zdcpp3/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/zlib-1.3-ydpab3sqqrc3drchckx3k2vtimkq325g/include -isystem /opt/spa
             ck-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/intel-oneapi-mpi-2021.10.0-hf2xl2zozzfq77hj6gqgj6p2s5cvtamc/mpi/2021.10.0/include -isystem /opt/spack-v0.
             21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/intel-oneapi-mpi-2021.10.0-hf2xl2zozzfq77hj6gqgj6p2s5cvtamc/include -isystem /opt/spack-v0.21/linux-ubuntu22.04
             -cascadelake/oneapi-2022.1.0/scotch-6.1.3-53r7376ur7shfppqtcmmtc4yp46cgskt/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/fftw-
             3.3.10-xmexu2pv6ahkhub2yqlkpe2pe52fjjrn/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/intel-oneapi-mkl-2023.2.0-7vwe4wkmwx5jvw
             yvdgxzplaj3aaa6rzg/mkl/2023.2.0/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/neso-particles-working-5maus3isodrfkjqvqrxa3lsco
             vivu3vs/include -isystem /opt/spack-v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/hdf5-1.14.3-bslkajy4be5akrrscejlaapkj2kxhqjq/include -isystem /opt/spack
             -v0.21/linux-ubuntu22.04-cascadelake/oneapi-2022.1.0/googletest-1.12.1-plr6miqylajyh54v7uzi5aany34bdyfq/include --dpcpp -fsycl  -O3 -DNDEBUG -std=gnu++17 -DMKL_
             ILP64 -fsycl -MD -MT test/CMakeFiles/unitTests.dir/unit/test_species.cpp.o -MF CMakeFiles/unitTests.dir/unit/test_species.cpp.o.d -o CMakeFiles/unitTests.dir/un
             it/test_species.cpp.o -c /home/js0259/git-ukaea/NESO/test/unit/test_species.cpp
     168     /usr/bin/ld: libnesolib.a(mesh.cpp.o): in function `Mesh::sycl_solve_for_electric_field_fft(cl::sycl::queue&, FFT&)':
  >> 169     mesh-5db441.cpp:(.text+0x5219): undefined reference to `oneapi::mkl::dft::descriptor<(oneapi::mkl::dft::precision)36, (oneapi::mkl::dft::domain)32>::commit(cl::
             sycl::queue&)'
  >> 170     /usr/bin/ld: mesh-5db441.cpp:(.text+0x5273): undefined reference to `void oneapi::mkl::dft::compute_forward<oneapi::mkl::dft::descriptor<(oneapi::mkl::dft::prec
             ision)36, (oneapi::mkl::dft::domain)32>, std::complex<double>, std::complex<double> >(oneapi::mkl::dft::descriptor<(oneapi::mkl::dft::precision)36, (oneapi::mkl
             ::dft::domain)32>&, cl::sycl::buffer<std::complex<double>, 1, cl::sycl::detail::aligned_allocator<char>, void>&, cl::sycl::buffer<std::complex<double>, 1, cl::s
             ycl::detail::aligned_allocator<char>, void>&)'
  >> 171     /usr/bin/ld: mesh-5db441.cpp:(.text+0x55d9): undefined reference to `oneapi::mkl::dft::descriptor<(oneapi::mkl::dft::precision)36, (oneapi::mkl::dft::domain)32>
             ::commit(cl::sycl::queue&)'
  >> 172     /usr/bin/ld: mesh-5db441.cpp:(.text+0x5623): undefined reference to `void oneapi::mkl::dft::compute_backward<oneapi::mkl::dft::descriptor<(oneapi::mkl::dft::pre
             cision)36, (oneapi::mkl::dft::domain)32>, std::complex<double>, std::complex<double> >(oneapi::mkl::dft::descriptor<(oneapi::mkl::dft::precision)36, (oneapi::mk
             l::dft::domain)32>&, cl::sycl::buffer<std::complex<double>, 1, cl::sycl::detail::aligned_allocator<char>, void>&, cl::sycl::buffer<std::complex<double>, 1, cl::
             sycl::detail::aligned_allocator<char>, void>&)'

Plus about 2k lines of missing oneapi sycl symbols.

@will-saunders-ukaea
Copy link
Contributor

Compiles and links outside the spack env with oneapi@2022.1.0 without issue.

@will-saunders-ukaea
Copy link
Contributor

Update: main throws the same linking errors for me when using the spack env with oneapi@2022.1.0.

@cmacmackin
Copy link
Contributor

Compiles and links outside the spack env with oneapi@2022.1.0 without issue.

I've actually been getting that error too. I thought it was just something peculiar to my machine, but guess it's more widespread. I think the problem might arise because somehow I've gotten it building against a different release of MKL than of the compilers. I'm going to try pinning MKL to the same version as the compiler and we'll see if that fixes it.

@cmacmackin
Copy link
Contributor

I've confirmed that the issue is with conflicting MKL versions. I'm going to see if I can modify the package file to prevent that from happening.

@cmacmackin
Copy link
Contributor

The issue with linking for the OneAPI/MKL tool chain isn't really related to this PR. I've updated the NESO package to prevent it happening in future and will create separate PRs for that. In the meantime, I'm going to merge this.

@cmacmackin cmacmackin merged commit b411422 into main Apr 17, 2024
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

Successfully merging this pull request may close these issues.

6 participants