conda-forge / cp2k-feedstock

A conda-smithy repository for cp2k.
BSD 3-Clause "New" or "Revised" License
4 stars 4 forks source link

features to enable #19

Open ltalirz opened 3 years ago

ltalirz commented 3 years ago

from installation instructions

ltalirz commented 2 years ago

Hey @dev-zero, @annahehn reached out with regards to adding libint to the cp2k version built on conda-forge.

As you pointed out in https://github.com/conda-forge/cp2k-feedstock/pull/12#issuecomment-759487406 , cp2k needs a specially configured libint so I guess we can't use the one from the libint feedstock (?).

However, I guess it may be relatively straightforward to build this specific libint during the cp2k build process (?). Could you perhaps provide the rough instructions we would need to add to the build.sh in order to do this?

P.S. I guess it would increase the build time significantly but looking at the libint feedstock their build takes of the order of 44 minutes so perhaps it's still doable.

dev-zero commented 2 years ago

Hey @dev-zero, @annahehn reached out with regards to adding libint to the cp2k version built on conda-forge.

As you pointed out in #12 (comment) , cp2k needs a specially configured libint so I guess we can't use the one from the libint feedstock (?).

No, you most likely can't unless it is configured exactly the same way as required (which is usually not the case). Details on how we need libint to be built can be found here: https://github.com/cp2k/libint-cp2k/blob/master/Jenkinsfile

However, I guess it may be relatively straightforward to build this specific libint during the cp2k build process (?). Could you perhaps provide the rough instructions we would need to add to the build.sh in order to do this?

Sure, I somewhat assumed that this is a no-go (as it is for many Linux distros).

What you need is the 2.6.0 tarball from https://github.com/cp2k/libint-cp2k/releases (or the CP2K package mirror) which contains the libint source code with the first step (the generation of the code with the required configuration) already done. From there you can do a simple configure/make/make install with the only thing to remember is to pass --enable-fortran. The toolchain script can serve as a blueprint (and a reminder to ensure CC/CFLAGS are set): https://github.com/cp2k/cp2k/blob/4eb5f9a884a8e3083aa1322b1d05a82a7f2f3db8/tools/toolchain/scripts/stage3/install_libint.sh#L81-L94 This is not an MPI-parallel package, so "normal" compilers can be used. If I'm not mistaken you should end up with a static library, modify the arch files accordingly (the easiest is to do a cp2k build locally with the toolchain to get a template, otherwise @annahehn can provide an example arch file.

P.S. I guess it would increase the build time significantly but looking at the libint feedstock their build takes of the order of 44 minutes so perhaps it's still doable.

On fast machines it is doable, especially when using our pre-prepared tarball.

Wrt your list of dependencies: libxsmm (not libsmm) which is likely part of the conda would be very important for CP2K. The only requirement is that the Fortran bindings are enabled. libvori would also be a low-hanging fruit you could integrate in the same way as libint.

dev-zero commented 2 years ago

Expect the binary size to grow (+80M) as libint consists of a lot of templated unrolled code. If debug symbols -g are enabled within conda: disable it for libint to half the size (or call strip on libint2.a before linking it with cp2k).

oschuett commented 2 years ago

Maybe the build time and binary size could be reduced by lowering --with-opt-am?

ltalirz commented 2 years ago

Dear both, thanks a lot for the quick reply and for the thoughtful suggestions!

Just for reference, I haven't started adding libint since @annahehn mentioned a vistor in their group may have a stab at adding support here.

@dev-zero Concerning libsmm: I think in the list above I likely meant to write libxsmm rather than libsmm. Is there even a way to turn off libsmm in cp2k? libxsmm is on conda-forge and could be added.

dev-zero commented 2 years ago

@ltalirz libsmm is/was optional before and required extra steps. The default is to use blas instead.

ltalirz commented 2 years ago

I see. I just searched for "smm" in the installation instructions and did not see any mention of a related configuration option. Am I overlooking something?

oschuett commented 2 years ago

I removed libsmm from the toolchain and the installation instructions (https://github.com/cp2k/cp2k/commit/9d664f589f2974eb2abbd05dbca882b4de6af279), see also https://github.com/cp2k/cp2k/issues/2044.

ltalirz commented 2 years ago

Thanks for the clarification - now that I look back into it, the feedstock already builds cp2k with libxsmm support. When I opened this issue, I probably only glanced over the installation instructions and failed to realize that libxsmm supersedes libsmm and that there is no point in adding both.

I've removed the corresponding bullet point from the to-do list.