Compilation with AOCC

Guys,

I’m having trouble compiling Psi4 using AOCC. So far I have installed and enabled a virtual environment for python (3.10.10) in order to separate it from the system python. I have installed numpy, scipy and matplotlib from pip for what it matters. I have downloaded Psi4 from git. AOCC and AOCL are obviously installed as well.

I am using this command to configure:

(venv) kirimu /epyc/aocc/psi4/src/psi4/build # cmake -DCMAKE_INSTALL_PREFIX=/epyc/aocc/psi4 -S. -Bbuild -DLAPACK_LIBRARIES="/epyc/aocc/compat/lib_LP64/libblis-mt.a;/epyc/aocc/compat/lib_LP64/libflame.a" -DCMAKE_Fortran_COMPILER=flang -DCMAKE_Fortran_FLAGS="-mp -fopenmp" -DMAX_AM_ERI=7 --fresh

AOCL libs seem to be found and enabled correctly. I also get the information that OpenMP is found. Then the build and install commands are pretty straightforward:

cd build/
cmake --build . -j24
cmake --install . --prefix /epyc/aocc/psi4

Compilation finishes without error, but when I try to load the psi4 module in python I get this:

(venv) kirimu:~ $ python
Python 3.10.10 (main, Apr  3 2023, 00:38:34) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psi4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/epyc/aocc/psi4/lib/psi4/__init__.py", line 71, in <module>
    from . import core
ImportError: /epyc/aocc/psi4/lib/psi4/core.cpython-310-x86_64-linux-gnu.so: undefined symbol: __kmpc_end_critical
>>> 

It looks like OpenMP libraries do not get linked. Anything I am missing? Any help would be greatly appreciated.

Hmm, I’ve never tried compiling Psi4 with those BLAS libraries. I’d check ldd objdir/stage/lib/core*so to look at what’s linked. And Psi4 is primarily C++, so I’d add the openmp flags to CMAKE_CXX_FLAGS and/or LAPACK_LIBRARIES. If there are dynamics AOCC libs, you might specify those instead of the static ones so one can track the library linkage easier.

Setting CMAKE_CXX_FLAGS correctly of course did the trick. I have no idea why I was insisting on using only CMAKE_Fortran_FLAGS…

Module now loads correctly, I am about to run the tests. Thanks!

1 Like

For anyone interested - installation with AOCC and AOCL seems to be working well. All tests passed with the following configure line:

cmake -DCMAKE_INSTALL_PREFIX=/epyc/aocc/psi4 -S. -Bbuild -DLAPACK_LIBRARIES="/epyc/aocc/compat/lib/libflame.a;/epyc/aocc/compat/lib/libblis-mt.a" -DCMAKE_Fortran_COMPILER=flang -DCMAKE_Fortran_FLAGS="-fopenmp -march=znver2" -DCMAKE_C_COMPILER=clang -DCMAKE_C_FLAGS="-fopenmp -march=znver2" -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-fopenmp -march=znver2" -DMAX_AM_ERI=7 --fresh

Great, I’m glad it worked. Thanks for the configure line – I’ve added it to a stray branch, so it should eventually be an example in the docs.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.