hypre-space / hypre

Parallel solvers for sparse linear systems featuring multigrid methods.
https://www.llnl.gov/casc/hypre/
Other
648 stars 182 forks source link

Configure CUCC/CUFLAGS need to be updated for SYCL and HIP #830

Open ARSanderson opened 1 year ago

ARSanderson commented 1 year ago

I am building Hypre with SCYL and needed to modify the compile flags for when ipcx is used. After looking at the config.status file I found that the CUCC and CUFLAGS are used even though configure help says they are for CUDA

./configure --help

CUCC CUDA compiler command CUFLAGS CUDA compiler flags

Understandable but a bit confusing. We are having to generalize similar flags/code in our project to accommodate CUDA/HIP/SYCL/KOKKOS.

I should also note that when I used CUFLAGS I was expecting the flags to be concatenated on to what configure setup. That is I wanted to add this: CUFLAGS="-fPIC"

But had to add this: CUFLAGS="-fPIC -O3 -fsycl -fsycl-unnamed-lambda"

Not sure what should have been expected.

waynemitchell commented 1 year ago

Yes, we currently abuse CUCC and CUFLAGS as the device code compiler and flags for all the different GPU backends (cuda/hip/sycl). As for appending to rather than overwriting the CUFLAGS, you can use the following configure option: --with-extra-CUFLAGS='-fPIC' This is our mechanism for providing flags in addition to the defaults generated by configure. Again this has bad naming... renaming all of these as generic GPU/device names rather than cuda is on our todo list.

ARSanderson commented 1 year ago

We have the same abuse happening in our code and trying figure out a path forward for CUDA/HIP/SYCP/Kokkos flags.

Thanks for --with-extra vs override that. I missed that and I realize now more.

A suggestion on the configure --help on environment vars. Move the --with-extra compile build flags into their own section right before the environment vars. And add to the message regarding the environment variables.

The result would be (modulo formatting):

Optional Build and Compile flags:
  --with-cxxstandard=val  User specifies c++ starndard in val.
  --with-LD=ARG           Set linker to ARG. The environment variable 'LD'
                          will be overridden.
  --with-LDFLAGS=ARG      User can manually set linker flags. The 'LDFLAGS'
                          environment variable will be overridden.
  --with-extra-CFLAGS=ARG Define extra C compile flag, where ARG is a
                          space-separated list (enclosed in quotes) of
                          directories.
  --with-extra-CXXFLAGS=ARG
                          Define extra C++ compile flag, where ARG is a
                          space-separated list (enclosed in quotes) of
                          directories.
  --with-extra-CUFLAGS=ARG
                          Define extra CUDA compile flag, where ARG is a
                          space-separated list (enclosed in quotes) of
                          directories.
  --with-extra-BUILDFLAGS=ARG
                          Define extra library build flag, where ARG is a
                          space-separated list (enclosed in quotes) of
                          directories.

Some influential environment variables:

List of variables ...

Use these variables to OVERRIDE the choices made by 'configure' or to help it to find libraries and programs with
nonstandard names/locations.  To add to the choices made by 'configure' use the '--with-extra-' argument
(e.g. --with-extra-CXXFLAGS=ARG). See above for specific flags.

That might help, though admit I missed the message at the bottom about the override.