GlobalArrays/ga

CMake: can't specify custom BLAS, fortran header files not installed

Closed this issue · 15 comments

With ./configure, I compile GA with:

--enable-i8 --with-blas8="-L/usr/local/OpenBLAS/lib -lopenblas"

With cmake I set ENABLE_I8=ON and ENABLE_BLAS=ON, but that uses the system's default libblas.so and liblapack.so. There seems to be no way with CMake to specify any other BLAS (or BLAS8). I presume this is why my application is crashing when I use the cmake-generated library. Setting ENABLE_BLAS=OFF causes a failure in the GA compilation.

Also, some files (at least those generated from .fh.in files in the cmake directory) are not copied with make install.

It seems to still be the case that there's no equivalent for --with-blas8 (and BLAS_VENDOR=OpenBLAS is unsupported?), and the file eaf.fh is missing from the CMake build, probably because the pario directory is commented out in CMakeLists.txt.

The latest CMake build is in the develop branch. Please use develop if you plan to use CMake (the options have also changed). OpenBLAS is supported, just not well tested yet (but it should mostly work). We can enable pario later today as well if you need it. LINALG_REQUIRED_COMPONENTS=ilp64 can be passed for enabling BLAS 8-byte ints. Please let us know if you need anything else to get it working on your end.

I could't make OpenBLAS to work, it fails due to missing pthread* symbols or something related to OpenMP (it could be a problem of my OpenBLAS compilation, though, I didn't dig much more). For OpenMolcas we would certainly need pario and maybe a "header" file with interfaces such as:

    subroutine GA_Brdcst(type,buf,lenbuf,root)
      integer :: type,lenbuf,root
      type(*) :: buf
    end subroutine GA_Brdcst

Otherwise compilers like gcc-10 will complain when they see calls to GA_Brdcst with differing types for buf.

The GCC 10 issue is already addressed by #157. Just apply the same fix to CMake, via -DCMAKE_Fortran_FLAGS if necessary.

If you compile OpenBLAS to use Pthreads, you will need to add -lpthread or -pthread to the linker command.

@Jellby Pushed a few fixes to develop. pario is built now. OpenBLAS discovery should also work. This is tested only with an OpenBLAS setup that was configured with OpenMP which I believe is what you are using. Please give it a shot and let us know if you still have problems.

Also, some files (at least those generated from .fh.in files in the cmake directory) are not copied with make install.

These are header files private to GA and do not need to be installed.

Thanks. What about global.fh?
EDIT: I see it is generated from .fh.in, but why is it supposed to be private, shouldn't the function type definitions be public?

Should these be ucommented?

add_library(ga
  $<TARGET_OBJECTS:ma>
  # $<TARGET_OBJECTS:dra>
  # $<TARGET_OBJECTS:eaf>
  # $<TARGET_OBJECTS:elio>
  # $<TARGET_OBJECTS:sf>

Yes, thanks for catching that. I just pushed to develop.

I get:

[ 70%] Linking Fortran shared library libga.so
global/src/CMakeFiles/ga_src.dir/fapi.c.o: In function `ga_idot_':
fapi.c:(.text+0x2f40): multiple definition of `ga_idot_'
pario/CMakeFiles/dra.dir/dra/global.unsup.c.o:global.unsup.c:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
CMakeFiles/ga.dir/build.make:225: recipe for target 'libga.so' failed
make[2]: *** [libga.so] Error 1
CMakeFiles/Makefile2:440: recipe for target 'CMakeFiles/ga.dir/all' failed
make[1]: *** [CMakeFiles/ga.dir/all] Error 2
Makefile:159: recipe for target 'all' failed
make: *** [all] Error 2

Also, is it possible to disable C++?

Can you send me your cmake configure line ? I can try to replicate the error on my end. By C++, do you mean ga++ sources ?

cmake -D ENABLE_BLAS=ON -D LINALG_REQUIRED_COMPONENTS=ilp64 -D LINALG_VENDOR=IntelMKL -D LINALG_PREFIX=/opt/mkl -D BUILD_SHARED_LIBS=ON -D CMAKE_INSTALL_PREFIX=/opt/GlobalArrays ..

(By the way, I also tried with OpenBLAS and got:)

-- Checking LAPACK version
CMake Error at /ga/build2/_deps/lapackpp-build/CMakeFiles/CMakeTmp/CMakeLists.txt:17 (add_executable):
  Target "cmTC_aefc9" links to target "OpenMP::OpenMP_CXX" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?


CMake Error at build2/_deps/lapackpp-src/cmake/LAPACKConfig.cmake:20 (try_run):
  Failed to generate test project build system.
Call Stack (most recent call first):
  build2/_deps/lapackpp-src/CMakeLists.txt:563 (include)


-- Configuring incomplete, errors occurred!

By C++, do you mean ga++ sources ?

Well, I mean I'd like it to work without a C++ compiler installed at all, I guess I don't need blaspp and lapackpp either.

Disabling C++ is already WIP via ENABLE_CXX option. I will push it today if I get some cycles otherwise it would be in there sometime tomorrow.

@Jellby Please pull and try a clean build by adding -DENABLE_CXX=OFF to your existing CMake line.

What about global.fh?

I accidentally removed this file from the install step during a commit yesterday. It's restored now.

With the latest changes GA seems to build and run fine for our needs with CMake, I hope it will make it to a new release soon. I'll call this closed and open a new issue if I find further problems.