yambo-code / yambo

This is the official GPL repository of the yambo code
http://www.yambo-code.eu/
GNU General Public License v2.0
91 stars 35 forks source link

Compiling Yambo GPL with Slepc #97

Open attacc opened 3 weeks ago

attacc commented 3 weeks ago

Compiling YamboGPL fomr scratch with the flag --enable-slepc-linalg Slepc and petsc compile but it seems that the generated modules are in the wrong folder, I got the error

make[2]: warning: -j2 forced in submake: resetting jobserver mode.
make[2]: *** [/home/attacc/SOFTWARE/yambo_gpl/config/mk/local/rules.mk:15: MATRIX_slepc.o] Error 1
Fatal Error: Cannot open module file ‘slepceps.mod’ for reading at (1): No such file or directory
    [driver] yambo (setup)
yambo linking failed. Check log/compile_yambo.log
Fatal Error: Cannot open module file ‘slepceps.mod’ for reading at (1): No such file or directory
make[1]: *** [config/mk/global/actions/compile_yambo.mk:44: yambo] Error 1
yambo build failed

I don't know if this problem has been already solved in some branch......

sangallidavide commented 3 weeks ago

Which branch is this?

attacc commented 3 weeks ago

The master

sangallidavide commented 3 weeks ago

Post here the config.report and the "configure command"

attacc commented 3 weeks ago

Here the configure command:

export YAMBO_LIBS=/home/attacc/local_gfortran/

./configure MPIFC=mpif90 FC=gfortran F77=gfortran  --enable-open-mp --enable-par-linalg  --enable-hdf5-par-io \
--with-scalapack-libs=mkl --with-blacs-libs=mkl \
--with-iotk-path="${YAMBO_LIBS}" --with-libxc-path="${YAMBO_LIBS}" \
--with-netcdf-path="${YAMBO_LIBS}" --with-netcdff-path="${YAMBO_LIBS}" --with-hdf5-path="${YAMBO_LIBS}" \
--enable slepc-linalg

and the configure report and log config.log compile_yambo.log

attacc commented 3 weeks ago

without --enable slepc-linalg it works

sangallidavide commented 3 weeks ago

If you do ls /home/attacc/local_gfortran//include -I/home/attacc/SOFTWARE/yambo_gpl/lib/external/gfortran/mpif90/single/include/slepceps.mod is the file there?

When linking internal libraries, the configure only checks that the file libslepc.a / libslepc.so exist, assuming that also the modules are there.

attacc commented 3 weeks ago

Now I notice that I get error in slepc compilation

/home/attacc/SOFTWARE/yambo_gpl/lib/slepc/slepc-3.20.2/installed-arch-linux2-c-debug-complex/include/slepcconf.h:9:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘were’
    9 | However, there were unannotated tags: try --tags."

and more

/home/attacc/SOFTWARE/yambo_gpl/lib/external/gfortran/mpif90/single/include/petscis.h:188:68: error: expected ‘)’ before ‘PetscInt’
  188 | PETSC_EXTERN PetscErrorCode ISLocalToGlobalMappingCreateSF(PetscSF, PetscInt, ISLocalToGlobalMapping *);
      |                                                                    ^~~~~~~~~
      |                                                                    )
gmake[8]: *** [gmakefile:192: installed-arch-linux2-c-debug-complex/obj/src/sys/dlregisslepc.o] Error 1
gmake[7]: *** [makefile:79: slepc_libs] Error 2

and so it does not produce the module,.... I will check where is the problem

sangallidavide commented 3 weeks ago

It is an issue I also experienced in the past.

In the file in slepcconf.h, the configure of the slepc library tries to define some variables like SLEPC_VERSION_GIT and similar, assuming the compilation is done from inside a git development branch of the slepc project.

Instead, we are compiling slepc from inside a git branch of the yambo project. Then, the variables get some random values which sometimes make the compilation fail. See the values in my case for example (in this case it works)

#define SLEPC_PETSC_DIR "/data/shared/yambo-libs/default/gfortran/mpifort.openmpi/single"
#define SLEPC_PETSC_ARCH ""
#define SLEPC_DIR "/data/sangalli/Codes/yambo/yambo-gpl/bug-fixes/lib/slepc/slepc-3.20.2"
#define SLEPC_LIB_DIR "/data/shared/yambo-libs/default/gfortran/mpifort.openmpi/single/lib"
#define SLEPC_VERSION_GIT "devel-andreaM-before-merge-1753-gc9dd471cfa"
#define SLEPC_VERSION_DATE_GIT "2024-05-16 14:04:04 +0200"
#define SLEPC_VERSION_BRANCH_GIT "maintenance-master"
#define SLEPC_HAVE_PACKAGES ":"
sangallidavide commented 3 weeks ago

Addendum. I had reported this to the slepc developers @joseeroman some time ago. They asked me to provide some extra info. I never replied ...

Requested info: can you go to the SLEPc directory under the yambo repo and run the following from there?

git rev-parse
git describe
git log -1 --pretty=format:%H
git log -1 --pretty=format:%ci
git describe --contains --all HEAD
git describe --match=v*
git rev-parse --abbrev-ref HEAD
attacc commented 3 weeks ago

Here the message I got running the previous commands:

$git describe
fatal: No annotated tags can describe 'f50165bfdaa4c1ca557eb652a5c48ab391987f70'.
However, there were unannotated tags: try --tags.
$git log -1 --pretty=format:%H
f50165bfdaa4c1ca557eb652a5c48ab391987f70
$git log -1 --pretty=format:%ci
2024-05-06 16:15:55 +0200
$git describe --contains --all HEAD
master
$git describe --match=v\* **
fatal: No names found, cannot describe anything.
$git rev-parse --abbrev-ref HEAD**
master
attacc commented 3 weeks ago

I tried to download yambo from scratch etc... removing MKL... but no way, I will try to compile slepc alone. Just for info I used gfortran GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

sangallidavide commented 3 weeks ago

I suspect the error is due to the first, which results in a multi-line output.

joseeroman commented 3 weeks ago

The issue comes from having a SLEPc git repo inside a yambo git repo. How can I reproduce it? That is, which configure options are needed in yambo to use a SLEPc git repo?

sangallidavide commented 3 weeks ago

I think you can just: (i) clone the yambo repo: git clone git@github.com:yambo-code/yambo.git (ii) enter the yambo folder and run the configure with slepc option ./configure --enable-slepc-linalg (iii) run make slepc -j

It may take some time since it will also download and compile petsc before arriving at the slepc step.

Alternative: (not sure it will work) (i) clone the yambo repo: git clone git@github.com:yambo-code/yambo.git (ii) enter the folder yambo/lib/slepc and download there a tarball of slepc (iii) extract the tarball, enter the folder slepc-versionXX and copile slepc as you usually do

joseeroman commented 3 weeks ago

Ok. Will look into it in the coming days.

attacc commented 3 weeks ago

Ok, in the while I wrote a small addition to the Yambo Wiki, to compile PetSC and SLepC out of Yambo and then use them with Yambo: https://www.yambo-code.eu/wiki/index.php/Install_Yambo_on_Ubuntu/LinuxMint_with_Intel_compiler

in this way everything is fine ( I did not check gfortran yet)

joseeroman commented 2 weeks ago

I think that the reported issue appears when SLEPc was downloaded from the gitlab site as a tarball instead of with git clone. I have improved the checking of this case in the SLEPc configure. The changes are here https://gitlab.com/slepc/slepc/-/merge_requests/672 - can you try?

sangallidavide commented 2 weeks ago

I agree the issue happens when downloading a tarball instead of doing git clone.

Thanks for the fix. To test the fix we would need a tarball, plus a machine where the issue happens ... not my case anymore, don't know why.

joseeroman commented 2 weeks ago

Ok. For now, I have merge the change to both main and release (note it would not work if one downloads a tag for an older version). Let me know if you see this problem again.

sangallidavide commented 2 weeks ago

Thanks. We will update the version which is internally downloaded by yambo as soon as the new tag is ready and let you know.