vecmem icon indicating copy to clipboard operation
vecmem copied to clipboard

Flag Determination Redesign, main branch (2024.09.09.)

Open krasznaa opened this issue 5 months ago • 1 comments

As discussed in some previous PRs, the build system making decisions about how clients should be using some of the templated code in vecmem::core and vecmem::sycl, just based on the capabilities of the compilers seen by this project's build, is not technically correct.

While clients of a built/installed vecmem project are not meant to use fundamentally different compilers to compile/link against the libraries, some flexibility is allowed. (And with some code rewrite, even more flexibility could potentially be achieved.)

Here I introduced two helper functions, vecmem_setup_core(...) and vecmem_setup_sycl(...), which would take care of figuring out what INTERFACE flags should be set up on vecmem::core and vecmem::sycl. This way these functions can be called by both core/CMakeLists.txt / sycl/CMakeLists.txt and any subsequent find_package(vecmem) calls as well.

In this new setup, when a client calls find_package(vecmem) in an environment in which a SYCL compiler is not available, they would see something like the following:

[bash][Celeborn]:vecmem > cmake -DCMAKE_PREFIX_PATH=$PWD/install-intel/usr/local -S test -B build-test
-- The CXX compiler identification is GNU 13.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found vecmem: /home/krasznaa/ATLAS/projects/vecmem/install-intel/usr/local/lib/cmake/vecmem-1.8.0/vecmem-config.cmake (found version "1.8.0")
-- Performing Test VECMEM_SUPPORT_POSIX_ATOMIC_REF
-- Performing Test VECMEM_SUPPORT_POSIX_ATOMIC_REF - Success
-- Looking for a SYCL compiler
-- Looking for a SYCL compiler - NOTFOUND
-- Configuring done (4.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/krasznaa/ATLAS/projects/vecmem/build-test
[bash][Celeborn]:vecmem >

While in an environment in which a SYCL compile is available, this changes to:

[bash][Celeborn]:vecmem > cmake -DCMAKE_PREFIX_PATH=$PWD/install-intel/usr/local -S test -B build-test
-- The CXX compiler identification is IntelLLVM 2024.2.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/krasznaa/software/intel/oneapi-2024.2.1/compiler/2024.2/bin/compiler/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found vecmem: /home/krasznaa/ATLAS/projects/vecmem/install-intel/usr/local/lib/cmake/vecmem-1.8.0/vecmem-config.cmake (found version "1.8.0")
-- Performing Test VECMEM_SUPPORT_POSIX_ATOMIC_REF
-- Performing Test VECMEM_SUPPORT_POSIX_ATOMIC_REF - Success
-- Looking for a SYCL compiler
-- Looking for a SYCL compiler - /home/krasznaa/software/intel/oneapi-2024.2.1/compiler/2024.2/bin/compiler/clang++
-- The SYCL compiler identification is IntelLLVM 2024.2.1
-- Check for working SYCL compiler: /home/krasznaa/software/intel/oneapi-2024.2.1/compiler/2024.2/bin/compiler/clang++
-- Check for working SYCL compiler: /home/krasznaa/software/intel/oneapi-2024.2.1/compiler/2024.2/bin/compiler/clang++ - works
-- Performing Test VECMEM_HAVE_SYCL_EXT_ONEAPI_PRINTF
-- Performing Test VECMEM_HAVE_SYCL_EXT_ONEAPI_PRINTF - Success
-- Performing Test VECMEM_HAVE_SYCL_ONEAPI_PRINTF
-- Performing Test VECMEM_HAVE_SYCL_ONEAPI_PRINTF - Failed
-- Performing Test VECMEM_HAVE_SYCL_ATOMIC_REF
-- Performing Test VECMEM_HAVE_SYCL_ATOMIC_REF - Success
-- Performing Test VECMEM_HAVE_SYCL_LOCAL_ACCESSOR
-- Performing Test VECMEM_HAVE_SYCL_LOCAL_ACCESSOR - Success
-- Configuring done (86.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/krasznaa/ATLAS/projects/vecmem/build-test
[bash][Celeborn]:vecmem >

Very similar to what Vc does. Whether or not that's a good thing... 🤔

(I was testing the build in WSL, to keep making sure that Windows compatibility would stay alive. Hence the horrendous configuration times. 😛)

To make all of this happen relatively conveniently, I also introduced the vecmem_check_sycl_source_compiles(...) function, with an API mimicking check_cxx_source_compiles(...). Converting most of the checks to using it, from the existing vecmem_check_sycl_code_compiles(...) calls.

krasznaa avatar Sep 09 '24 08:09 krasznaa