Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASTEP 23.1.1 and CASTEP 24.1 #59

Open
heatherkellyucl opened this issue Jun 21, 2024 · 87 comments
Open

CASTEP 23.1.1 and CASTEP 24.1 #59

heatherkellyucl opened this issue Jun 21, 2024 · 87 comments

Comments

@heatherkellyucl
Copy link
Collaborator

The existing recipe covers CASTEP 19.1.1.rc2 and 21.11.

I have added the checksum for 23.1.1 in repos/dev/packages/castep/package.py

Need to check if there are any flags or variants needed for this version, if it compiles and if it works.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jun 21, 2024

I've added these variants:

    variant("grimmed3", default=False, description="Enable Grimme DFT+D library")

    variant("grimmed4", default=False, when="@23:", description="Enable Grimme D4 library")

    variant(
        "libxc", default=False, when="@23:",
        description="Enable libxc library of additional XC functionals"
    )

and some depends_on, around the existing mpi one:

    depends_on("perl", type=("build", "run"))
    depends_on("mpi", type=("build", "link", "run"), when="+mpi")
    depends_on("libxc", type=("build", "link", "run"), when="+libxc")

(not sure if libxc is needed at runtime)
and this is where it adds them to the build options:

        # "system" for existing libxc, "compile" to build own
        if "+libxc" in spec:
            targetlist.append("LIBXC=system")

        if "+grimmed3" in spec:
            targetlist.append("GRIMMED3=compile")

        if "+grimmed4" in spec:
            targetlist.append("GRIMMED4=compile")

Can't enable the xml variant right now because it requires FoX: A Fortran library for XML processing which isn't in Spack right now. The only fox is a C++ toolkit. (Quantum Espresso builds its own FoX). So it would need a different name if I added it.

CASTEP has a cmake build system too - probably that one should be added as well (https://spack.readthedocs.io/en/latest/packaging_guide.html#writing-a-package-recipe) but not right now.

I don't think the recipe builds castep.serial right now, which we want it to do. You'd normally do a serial build as well as the mpi build and install them both into the same place. To check.

@heatherkellyucl
Copy link
Collaborator Author

Altered the new variants above to add the when="@23:" since they were added in that version.

I was hoping if our source mirror was there then it would look in it for the tar file automatically - that doesn't appear to be the case so another bit of config needs adjusting. For right now, the package recipe tells it to look in the current directory for the source, so copying in there works.

However, part of the filter is wrong for this version:

==> Installing castep-23.1.1-2h2cflxs6gt2prrzr7kzuod7tktms4d5 [96/100]
==> No binary for castep-23.1.1-2h2cflxs6gt2prrzr7kzuod7tktms4d5 found: installing from source
==> Fetching file:///lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/castep-23.1.1.tar.bz2
==> No patches needed for castep
==> castep: Executing phase: 'edit'
==> Error: FileNotFoundError: [Errno 2] No such file or directory: 'LibSource/dl_mg-2.0.3/platforms/castep.inc
'

/lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/repos/dev/packages/castep/package.py:67, in edit:
         64    def edit(self, spec, prefix):
         65        if spec.satisfies("%gcc"):
         66            dlmakefile = FileFilter("LibSource/dl_mg-2.0.3/platforms/castep.inc")
  >>     67            dlmakefile.filter(r"MPIFLAGS = -DMPI", "MPIFLAGS = -fallow-argument-mismatch -DMPI")
         68            if self.spec.satisfies("@20:"):
         69                platfile = FileFilter("obj/platforms/linux_x86_64_gfortran.mk")
         70            else:

See build log for details:
  /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-23.1.1-2h2cflxs6gt2prrzr7kzuod7tktms4d5/spack-build-out.txt

It is because it is LibSource/dl_mg-3.0.0 in this version, need to add logic for that.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jun 24, 2024

I confirmed that dl_mg-3.0.0 does also need -fallow-argument-mismatch adding to the MPIFLAGS.

Changed to:

            if self.spec.satisfies("@19:21"):
                dlmakefile = FileFilter("LibSource/dl_mg-2.0.3/platforms/castep.inc")
            if self.spec.satisfies("@23:"):
                dlmakefile = FileFilter("LibSource/dl_mg-3.0.0/platforms/castep.inc")
            dlmakefile.filter(r"MPIFLAGS = -DMPI", "MPIFLAGS = -fallow-argument-mismatch -DMPI")

@heatherkellyucl
Copy link
Collaborator Author

Still got type mismatches.

==> Error: ProcessError: Command exited with status 2:
    'make' '-j6' 'PWD=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-cast
ep-23.1.1-2h2cflxs6gt2prrzr7kzuod7tktms4d5/spack-src' 'COMMS_ARCH=mpi' 'FFTLIBDIR=/lustre/shared/ucl/apps/spac
k/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_pla
ceholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_place
holder__/linux-rhel7-cascadelake/gcc-12.3.0/fftw-3.3.10-3hrfzp6xsbvyfdebwta53swqul7tt3x4/lib' 'MATHLIBDIR=/lus
tre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeh
older__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placehol
der__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/openblas-0.3.26-mtr3n5zbgfqoca4pjp5xx5gotc5dqvhy/lib' 'FFT=fftw3' 'MATHLIBS=openblas' 'ARCH=linux_x86_64_gfortran'

242 errors found in build log:
     262
     263     22418 |        call MPI_allreduce(local_array,z_array(bufpos),min(buflen,length-bufpos+1),&
     264           |                          1
     265     ......
     266     22517 |        call MPI_allreduce(local_array,d_array(bufpos),min(buflen,length-bufpos+1),&
     267           |                          2
  >> 268     Error: Type mismatch between actual argument at (1) and actual argument at (2) (COMPLEX(8)/REAL(
             8)).
     269     ../../../Source/Utility/comms.mpi.F90:22418:38:
...

  >> 2180    Error: Type mismatch between actual argument at (1) and actual argument at (2) (CHARACTER(12)/IN
             TEGER(4)).
  >> 2181    make[1]: *** [../../include_rules.mk:155: comms.mpi.anc] Error 1
...

See build log for details:
  /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-23.1.1-2h2cflxs6gt2prrzr7kzuod7tktms4d5/spack-build-out.txt

@giordano
Copy link
Member

You can try adding fflags=-fallow-argument-mismatch to the spec as an alternative, which forces the flag in the wrapper of the fortran compiler used by spack.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jun 24, 2024

I'll have a go like that temporarily.

It looks like it needs adding in the package.py to FFLAGS_FOR_LIBRARIES in obj/platforms/linux_x86_64_gfortran.mk since it already gets added to FFLAGS_E which are the general flags.

# Flags for building third-party libraries (DL_MG, D3, D4). Assign with "=" to include $(OPT) defined later
#
FFLAGS_FOR_LIBRARIES = -fconvert=big-endian -fopenmp -fPIC -ffpe-summary=none $(OPT)

@heatherkellyucl
Copy link
Collaborator Author

Though there is a linux_x86_64_gfortran10.mk so maybe we should be using that now.

@heatherkellyucl
Copy link
Collaborator Author

Including in spec worked, as castep@23.1.1 fflags=-fallow-argument-mismatch:

==> Installing castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel [96/101]
==> No binary for castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel found: installing from source
==> Using cached archive: /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/cache/_source-ca
che/archive/8d/8d922c641c99fc6e4f5b4f7f2478abab897065850e454fb4968154ddbb566388.tar.bz2
==> No patches needed for castep
==> castep: Executing phase: 'edit'
==> castep: Executing phase: 'build'
==> castep: Executing phase: 'install'
==> castep: Successfully installed castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel
  Stage: 26.42s.  Edit: 0.20s.  Build: 4m 20.51s.  Install: 1m 2.18s.  Post-install: 3.08s.  Total: 6m 3.66s

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jun 24, 2024

There's a linux_x86_64_gfortran10.mk in our 20.1 source as well, so it looks like it has existed since then and should probably be the one used in all versions after 19.x. Assuming that works.

@heatherkellyucl
Copy link
Collaborator Author

Working out how to include this lot of recommended and incompatible compilers is going to be interesting...

 USE: The following compilers have been tested and confirmed to
 correctly compile CASTEP 23.1.1

 *  Intel Fortran 18.0.2+, 19.0.0, 19.0.2
 *  Intel oneAPI Fortran (classic) 2021.2.0-2021.3.0, 2021.5.0-2021.6.0
    (packaged as oneAPI version 2021.2,2021.3,2022.0.1,2022.0.2,2022.1.0)
 *  GNU Fortran   7.2-7.5, 8.*, 9.2, 9.3.0, 10.1.0, 11.x, 12.x
 *  NVIDIA/PGI    nvhpc 20.7-21.X, 22.5, 22.11 (+)
 *  NAG Fortran   7.1
 *  Cray Fortran  11.0.4, 12.0.3, 13.0.2 (++)

 AVOID: The following compilers either have bugs which result in at least one
 failure, either during compilation or a crash or incorrect
 results at runtime, or do not support the language standards required.
 There may be more details of the seriousness of
 the failures in the platform-specific sections below.

 *  Intel Fortran < 18.0, 18.0.0, 18.0.1 (*), 19.1.0(**)
 *  Intel oneAPI - ifx (any version) The new flang-based compiler (ifx) 
    suffers an ICE on attempted compile.
 *  Intel oneAPI classic (ifort) 2021.4.0, 2021.7.0,2021.7.1
    packaged as oneAPI 2021.4, 2022.2.0, 2022.2.1
    Various run-time failures on the test suite.
 *  NVidia nvfortran 22.7-22.10
 *  AMD AOCC flang < 4.0 (***)
 *  PGI Fortran < 19.x
 *  Oracle/Sun fortran (all versions) (****)
 *  Cray Fortran  11.0.x
 *  AMD AOCC flang (++)

For footnotes see README.INSTALL.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jul 11, 2024

Looking at https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/quantum-espresso/package.py for examples because it has lots of different kinds of conflicts.

    # Internal compiler error gcc8 and a64fx, I check only 6.5 and 6.6
    conflicts(
        "@5.3:", when="%gcc@8 target=a64fx", msg="Internal compiler error with gcc8 and a64fx"
    )
    with when("%nvhpc"):
        variant("cuda", default=False, description="Build with CUDA Fortran")
        with when("+cuda"):
            conflicts(
                "%nvhpc@21.11:22.3",
                msg="bugs with NVHPCSDK from v21.11 to v22.3, OpenMP and GPU",
            )

So like this? (https://spack.readthedocs.io/en/latest/basic_usage.html#version-specifier)

with when ("%intel-oneapi-compilers-classic"):
    conflicts(
        "%intel-oneapi-compilers-classic@2021.4.0,2021.7",
        msg="Various run-time failures on the test suite with ifort 2021.4.0, 2021.7.0, 2021.7.1",
    )

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jul 15, 2024

The build stage with the source and tests are in /shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-23.1.1-2h2cflxs6gt2prrzr7kzuod7tktms4d5/spack-src/Test/ still at the moment.

To run test suite at its simplest, just run

make

in this directory or

make check

in the top-level directory. Tests will be run using the CASTEP executable
"obj/$ARCH/castep", ie the default compiled executable. "make check ARCH=xxx"
works as expected, running the alternative executable.

The module for this CASTEP install is at /shared/ucl/apps/spack/0.22/hk-initial-stack/modules/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/linux-rhel7-cascadelake/castep/23.1.1-openmpi/gcc-12.3.0

(Need to fix that somewhere).

@heatherkellyucl
Copy link
Collaborator Author

module use /shared/ucl/apps/spack/0.22/hk-initial-stack/modules/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/linux-rhel7-cascadelake

module avail castep
- /shared/ucl/apps/spack/0.22/hk-initial-stack/modules/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/linux-rhel7-cascadelake -
castep/23.1.1-openmpi/gcc-12.3.0  

--------------------------------- /shared/ucl/apps/modulefiles/applications ----------------------------------
castep/17.2/intel-2017  castep/17.21/intel-2017  castep/19.1.1/intel-2019 

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jul 15, 2024

Needed to make sure gcc@12.3.0 is explicitly added to the environment too, since only the gcc-runtime was there as a module.

Then regenerated modules.

spack -e myriad add gcc@12.3.0
spack -e myriad concretize
spack -e myriad install
spack -e myriad module tcl refresh
module avail gcc
- /shared/ucl/apps/spack/0.22/hk-initial-stack/modules/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/linux-rhel7-cascadelake -
gcc-runtime/11.2.1/gcc-11.2.1  gcc-runtime/12.3.0/gcc-12.3.0  gcc/12.3.0/gcc-11.2.1  

----------------------------------- /shared/ucl/apps/modulefiles/libraries -----------------------------------
gcc-libs/4.9.2  gcc-libs/7.3.0  gcc-libs/8.3.0  gcc-libs/9.2.0  gcc-libs/10.2.0  

The gcc-runtimes are like our gcc-libs, and the gcc loads some other modules and sets up CC, CXX, FC, F77 like our compilers/gnu modules.

@heatherkellyucl
Copy link
Collaborator Author

I want to build some of the tests, so need the compiler module, plus our already-built castep:

[ccspapp@build01 castep-castep-65582dd54bf3]$ module load gcc/12.3.0/gcc-11.2.1
Loading gcc/12.3.0/gcc-11.2.1
  Loading requirement: glibc/2.17/gcc-11.2.1 gcc-runtime/11.2.1/gcc-11.2.1 zlib/1.3.1/gcc-11.2.1
    zstd/1.5.5/gcc-11.2.1 binutils/2.42/gcc-11.2.1 gmp/6.2.1/gcc-11.2.1 mpfr/4.2.0/gcc-11.2.1
    mpc/1.3.1/gcc-11.2.1
[ccspapp@build01 castep-castep-65582dd54bf3]$ module load castep/23.1.1-openmpi/gcc-12.3.0
Loading castep/23.1.1-openmpi/gcc-12.3.0
  Loading requirement: gcc-runtime/12.3.0/gcc-12.3.0 libpciaccess/0.17/gcc-12.3.0 libiconv/1.17/gcc-11.2.1
    xz/5.4.6/gcc-11.2.1 libxml2/2.10.3/gcc-11.2.1 ncurses/6.4/gcc-11.2.1 hwloc/2.9.1/gcc-12.3.0
    knem/1.1.4/gcc-12.3.0 openssl/3.3.0/gcc-12.3.0 libevent/2.1.12/gcc-12.3.0 libfabric/1.21.0/gcc-12.3.0
    numactl/2.0.14/gcc-12.3.0 opa-psm2/11.2.230/gcc-12.3.0 bzip2/1.0.8/gcc-11.2.1 pigz/2.8/gcc-11.2.1
    tar/1.30/gcc-11.2.1 gettext/0.22.5/gcc-11.2.1 krb5/1.20.1/gcc-12.3.0 libedit/3.1-20230828/gcc-12.3.0
    libxcrypt/4.4.35/gcc-12.3.0 openssh/9.7p1/gcc-12.3.0 pmix/5.0.1/gcc-12.3.0 ucx/1.16.0/gcc-12.3.0
    xpmem/2.6.5-36/gcc-12.3.0 openmpi/4.1.6/gcc-12.3.0 fftw/3.3.10-openmpi/gcc-12.3.0
    openblas/0.3.26/gcc-12.3.0 berkeley-db/18.1.40/gcc-11.2.1 readline/8.2/gcc-11.2.1 gdbm/1.23/gcc-11.2.1
    perl/5.38.0/gcc-11.2.1

[ccspapp@build01 castep-castep-65582dd54bf3]$ castep.mpi
Usage:
castep <seedname>                : Run files <seedname>.cell [and <seedname>.param]
  "    [-d|--dryrun] <seedname>  : Perform a dryrun calculation on files <seedname>.cell
  "    [-s|--search] <text>      : print list of keywords with <text> match in description
  "    [-v|--version]            : print version information
  "    [-h|--help] <keyword>     : describe specific keyword in <>.cell or <>.param
  "         "      all           : print list of all keywords
  "         "      basic         : print list of basic-level keywords
  "         "      inter         : print list of intermediate-level keywords
  "         "      expert        : print list of expert-level keywords
  "         "      dummy         : print list of dummy keywords

@heatherkellyucl
Copy link
Collaborator Author

Going to use the non-build-stage untarring of castep which is in ccspapp's Scratch.

[ccspapp@build01 castep-castep-65582dd54bf3]$ pwd
/home/ccspapp/Scratch/castep/castep-castep-65582dd54bf3
[ccspapp@build01 castep-castep-65582dd54bf3]$ cd Test
[ccspapp@build01 Test]$ make CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel/bin/castep.mpi
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --total-processors=36 -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel/bin/castep.mpi -c simple -c d3-simple -c d4-simple
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... [486/486]

Uh, I think that worked? 486 tests passed.

@heatherkellyucl
Copy link
Collaborator Author

Can look in Dispersion/HeNe_D3/test.out.150724.inp\=HeNe_D3_PBE-geom.param for one of the test outputs.

Ends with

     Hirshfeld Analysis
     ------------------
Species   Ion     Hirshfeld Charge (e)
======================================
  He       1                 0.00
  Ne       1                -0.00
======================================


Writing analysis data to HeNe_D3_PBE-geom.castep_bin

Writing model to HeNe_D3_PBE-geom.check
 
 A BibTeX formatted list of references used in this run has been written to 
 HeNe_D3_PBE-geom.bib
 
Initialisation time =      0.82 s
Calculation time    =      9.19 s
Finalisation time   =      0.06 s
Total time          =     10.07 s
Peak Memory Use     = 4983964 kB

@heatherkellyucl
Copy link
Collaborator Author

That was all with the install that was doing castep@23.1.1 fflags=-fallow-argument-mismatch.

I have pushed some changes to repos/dev/packages/castep/package.py that need testing next (and that's going to need some tidying because there are 'if version' combos all over the place).

@heatherkellyucl
Copy link
Collaborator Author

I found why the pkg-store wasn't working, mirrors need a specific structure and don't just look for the archive in that path. <name>/<name>-<version>.<extension>. https://spack.readthedocs.io/en/latest/mirrors.html#mirrors

So on Myriad, I have added castep and orca subdirectories to pkg-store now that have the correct structure and name for the most recent packages. I've left the original package names at the top level for now since our buildscripts use them as they were - should tidy that up so there aren't duplicates.

@heatherkellyucl
Copy link
Collaborator Author

Can try auditing my package to find problems (not sure exactly what it does/doesn't pick up).

spack audit packages castep
PKG-DIRECTIVES: 0 issues found.
PKG-ATTRIBUTES: 0 issues found.
PKG-PROPERTIES: 0 issues found.

Then uninstall my previous build so I can try again with the updated package recipe.

[ccspapp@build01 hpc-spack]$ spack -e myriad uninstall castep
    -- linux-rhel7-cascadelake / gcc@12.3.0 -------------------------
    odprczk castep@23.1.1

==> 1 packages will be uninstalled. Do you want to proceed? [y/N] y
==> Successfully uninstalled castep@23.1.1%gcc@12.3.0~grimmed3~grimmed4~libxc+mpi build_system=makefile arch=linux-rhel7-cascadelake/odprczk

@giordano
Copy link
Member

(not sure exactly what it does/doesn't pick up).

It should mainly do static checks, like consistency of dependencies (in case you depend on non-existing versions of a package), or the use deprecated versions, etc.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jul 16, 2024

Deleted cached archive so we start fresh again:

rm /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/cache/_source-cache/archive/8d/8d922c641c99fc6e4f5b4f7f2478abab897065850e454fb4968154ddbb566388.tar.bz2
spack -e myriad install

==> Installing castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel [99/104]
==> No binary for castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel found: installing from source
==> Fetching file:///shared/ucl/apps/pkg-store/castep/castep-23.1.1.tar.bz2
==> No patches needed for castep
==> castep: Executing phase: 'edit'
==> castep: Executing phase: 'build'
==> castep: Executing phase: 'install'
==> castep: Successfully installed castep-23.1.1-odprczkj44tekqlbv4rwbzpdfecfsvel
  Stage: 29.49s.  Edit: 0.02s.  Build: 4m 32.94s.  Install: 1m 1.82s.  Post-install: 2.16s.  Total: 6m 13.29s

and done, so looks like using the linux_x86_64_gfortran10.mk works fine.

@heatherkellyucl
Copy link
Collaborator Author

I think platfile.filter(r"^\s*FFLAGS_E\s*=.*", "FFLAGS_E = -fallow-argument-mismatch ") is only needed if you are a) building castep 19 or b) building newer castep using a compiler older than gcc 10. linux_x86_64_gfortran10.mk ought to add it in for all the bits that need it for gcc10 onwards.

It might even only be needed for a) building castep 19 with gcc 10+ but I'm not sure of that and would need to check with older compilers that we don't want to use to make sure. (Maybe later).

@heatherkellyucl
Copy link
Collaborator Author

Changed repos/dev/packages/castep/package.py to reflect the top one. Still builds fine with gcc-12.3.0.

The gcc bit currently looks like this:

        if spec.satisfies("%gcc"):
            if self.spec.satisfies("@19:21"):
                dlmakefile = FileFilter("LibSource/dl_mg-2.0.3/platforms/castep.inc")
            elif self.spec.satisfies("@23:"):
                dlmakefile = FileFilter("LibSource/dl_mg-3.0.0/platforms/castep.inc")

            if self.spec.satisfies("@20:"):
                if spec.satisfies("%gcc@10:"):
                    platfile = FileFilter("obj/platforms/linux_x86_64_gfortran10.mk")
                else:
                    platfile = FileFilter("obj/platforms/linux_x86_64_gfortran.mk")
                    platfile.filter(r"^\s*FFLAGS_E\s*=.*", "FFLAGS_E = -fallow-argument-mismatch ")
            elif self.spec.satisfies("@19"):
                if spec.satisfies("%gcc@9:"):
                    platfile = FileFilter("obj/platforms/linux_x86_64_gfortran9.0.mk")
                else:
                    platfile = FileFilter("obj/platforms/linux_x86_64_gfortran.mk")
                dlmakefile.filter(r"MPIFLAGS = -DMPI", "MPIFLAGS = -fallow-argument-mismatch -DMPI")
                platfile.filter(r"^\s*FFLAGS_E\s*=.*", "FFLAGS_E = -fallow-argument-mismatch ")

            platfile.filter(r"^\s*OPT_CPU\s*=.*", "OPT_CPU = ")

@heatherkellyucl
Copy link
Collaborator Author

Need to test the +libxc, +grimmed3 and +grimmed4 variants. libxc is the one that brings in an additional dependency as the other two build their own.

@heatherkellyucl
Copy link
Collaborator Author

Uninstalled current build again. Removed castep@21.1.1 from /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/spack.yaml or we end up with both.

[ccspapp@build01 hpc-spack]$ spack -e myriad add castep@23.1.1 +libxc
==> Adding castep@23.1.1+libxc to environment myriad
[ccspapp@build01 hpc-spack]$ spack -e myriad concretize
spack -e myriad install

==> Installing castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu [100/104]
==> No binary for castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu found: installing from source
==> Using cached archive: /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/cache/_source-cache/archive/8d/8d922c641c99fc6e4f5b4f7f2478abab897065850e454fb4968154ddbb566388.tar.bz2
==> No patches needed for castep
==> castep: Executing phase: 'edit'
==> castep: Executing phase: 'build'
==> castep: Executing phase: 'install'
==> castep: Successfully installed castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu
  Stage: 28.69s.  Edit: 0.01s.  Build: 4m 22.24s.  Install: 1m 1.65s.  Post-install: 1.28s.  Total: 5m 59.89s

Different hash, and we have the +libxc version:

spack -e myriad find --variants castep
...
==> Installed packages
-- linux-rhel7-cascadelake / gcc@12.3.0 -------------------------
castep@23.1.1~grimmed3~grimmed4+libxc+mpi build_system=makefile
==> 1 installed package

and the module at /shared/ucl/apps/spack/0.22/hk-initial-stack/modules/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/linux-rhel7-cascadelake/castep/23.1.1-openmpi/gcc-12.3.0

now includes this when it did not before:

    depends-on libxc/6.2.2/gcc-12.3.0

Need to rerun the tests.

@heatherkellyucl
Copy link
Collaborator Author

Those tests are all ok again - need to see if there's anything specific to libxc.

make CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu/bin/castep.mpi 
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --total-processors=36 -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu/bin/castep.mpi -c simple -c d3-simple -c d4-simple
...................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... [486/486]

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Jul 16, 2024

Ok, there is Test/XC/libXC/ and make check-libxc (and I should run some with COMMS_ARCH=mpi to do mpi checking).

@heatherkellyucl
Copy link
Collaborator Author

[ccspapp@build01 Test]$ make check-libxc CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu/bin/castep.mpi
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --total-processors=36 -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu/bin/castep.mpi -c libXC-simple
.. [2/2]

So the libxc tests are fine.

The MPI tests are not happy, probably need to add more options:

[ccspapp@build01 Test]$ make CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu/bin/castep.mpi COMMS_ARCH=mpi
Found mpirun, using PARALLEL_CMD=mpirun -np tc.nprocs
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --processors=4 --total-processors=36 --user-option castep run_cmd_template "../../../bin/run_castep_test.pl tc.program tc.args tc.input tc.output mpirun -np tc.nprocs" -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1.1-niix677nq5we7h63kt3mdabhnu4tlfuu/bin/castep.mpi -c simple -c d3-simple -c d4-simple -c md-parallel
--------------------------------------------------------------------------
WARNING: Could not generate an xpmem segment id for this process'
address space.

The vader shared memory BTL will fall back on another single-copy
mechanism if one is available. This may result in lower performance.

  Local host: build01   
  Error code: 2 (No such file or directory)
--------------------------------------------------------------------------
[build01.myriad.ucl.ac.uk:132243] 3 more processes have sent help message help-btl-vader.txt / xpmem-make-failed
[build01.myriad.ucl.ac.uk:132243] Set MCA parameter "orte_base_help_aggregate" to 0 to see all help / error messages

@krefson
Copy link

krefson commented Sep 4, 2024

I've just been alerted to this thread. Sorry you are having so much difficulty with the cmake build - this was new in 23.1 and there is much complexity needed to support the build and test process flexibly and fully.

The first issue you found is simply that older versions of git report "Not a git repo" which was later changed to "not a git repo", and is fixed by a simple change to the regexp ("[Nn]ot a git repo") in cmake/buildinfo_script.cmake - which I will include for 25.1.

[scarf035@cn1052 ~]$ /usr/bin/git --version
git version 1.8.3.1
[scarf035@cn1052 ~]$ /usr/bin/git status --short --untracked=no --porcelain
fatal: Not a git repository (or any parent up to mount point /home/vol05)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
[scarf035@cn1052 ~]$ ~/bin/git --version
git version 2.9.5
[scarf035@cn1052 ~]$ ~/bin/git status --short --untracked=no --porcelain
fatal: Not a git repository (or any parent up to mount point /home/vol05)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
[scarf035@cn1052 ~]$ module load git
[scarf035@cn1052 ~]$ git --version
git version 2.42.0
[scarf035@cn1052 ~]$ git status --short --untracked=no --porcelain
fatal: not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

The other issue is more concerning. The purpose of the "gitinfo.dat" file is an attempt to track the metadata of the CASTEP version across a tarball distribution. If it is missing, that means the source is of unknown provenance, and my inclination is that it is good that such a build fails - certainly in the case of an HPC install! The official release tarball on https://licences.stfc.ac.uk/ has it:

$ tar tf ~/Downloads/CASTEP-23.1.tar.gz | grep gitinfo.dat
CASTEP-23.1/gitinfo.dat

so something is amiss or astray with the source. I do not recommend running bin/mkbuildinfo.pl for a cmake build as this is the script for the GNU make build.

We did release an update patch for 23.1 in addition to the official release, which may be downloaded from licenses.stfc.ac.uk. This ought also to fix any issues with the compile flags of the liibraries with gfortran 10 and above, as well as a couple of build issues on ARCHER2 highlighted by Andy Turner.

77c102798890a9d15faa63e9122c4d06 Castep_23.1_build_fixes.diff.gz
ab349319881334ad55b49dc9765beb06 CASTEP-23.1.tar.gz

This will still need the patch to the regexp in cmake/buildinfo_script.cmake if your version of git is too old.

The cmake build is more stable in 24.1, which was released six months ago, by the way.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 4, 2024

@krefson

Oh, castep.org still only has news for 23.1.1 as the most recent release so I didn't go looking if I could get a download for 24.

I have castep-23.1.1.tar.bz2 which untars as castep-castep-65582dd54bf3 and I got from the official sources - possibly in June 2023? (Or at least that's the date on the tarball, I'm assuming I got it a bit later).

@krefson
Copy link

krefson commented Sep 4, 2024

Thanks for pointing out the out-of-date news release headline on the licenses site.

65582dd54bf3 is the git hash we tagged as Castep-23.1.1_release. But possibly created "unofficially" by some file transfer/copy? We use the GNU make target "make dist" to create the tarball, which untars into CASTEP-23.1 and importantly, creates "gitinfo.dat" on the fly.

FYI, that gitinfo.dat reads

GIT_HASH=65582dd54
GIT_BRANCH=Castep231_branch
GIT_DATE=Wed May 17 11:09:44 2023 +0100
GIT_MODIFIED=

I would recommend downloading and applying the patch Castep_23.1_build_fixes.diff which also fixes a couple of significant bugs, as well as a compile error with some of the additional tools, which it appears you may also have run into.

@heatherkellyucl
Copy link
Collaborator Author

I've attempted to sign up for the new version so I can get it and the patch - when we got the last one was definitely pre the current site, so it might have been in the transition period when the license signup was being reworked.

@heatherkellyucl
Copy link
Collaborator Author

Alrighty, got 24.1 and the updated 23.1 and fixes.

@heatherkellyucl
Copy link
Collaborator Author

Right, finally getting back to this.

Going to test the outside-Spack build of 23 with the patches first. If I add Spack's git to my modules I should have the same behaviour in both cases.

module use /shared/ucl/apps/spack/0.22/hk-initial-stack/modules/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/var/spack/environments/myriad/linux-rhel7-cascadelake/
module load gcc/12.3.0/gcc-11.2.1
module load cmake/3.27.9/gcc-12.3.0
module load rsync/3.2.7/gcc-12.3.0
module load openblas/0.3.26/gcc-12.3.0 
module load fftw/3.3.10-openmpi/gcc-12.3.0
module load perl/5.38.0/gcc-11.2.1
module load openmpi/4.1.6/gcc-12.3.0 
module load libxc/6.2.2/gcc-12.3.0
module load git/2.42.0/gcc-12.3.0

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 16, 2024

gunzip -c Castep_23.1_build_fixes.diff.gz > Castep_23.1_build_fixes.diff
patch -p1 < Castep_23.1_build_fixes.diff

Patched things. (Note: Spack can use a gzipped patch from a url as long as you give it the sha256 for the archive as well as the expanded file).

cmake -B ../castep_23.1_install/build -DWITH_MPI=ON -DWITH_LIBXC=ON -DCMAKE_INSTALL_PREFIX=../castep_23.1.1_install
cd ../castep_23.1_install/build/
make
make install

The build completed without any issues, the install still failed at libxc.

[100%] Built target castep.mpi
Install the project...
-- Install configuration: "FAST"
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/include/xc.h
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/include/xc_funcs.h
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/include/xc_funcs_worker.h
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/include/xc_funcs_removed.h
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/include/xc_version.h
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/bin/xc-info
-- Set runtime path of "/home/ccspapp/Scratch/castep/castep_23.1.1_install/bin/xc-info" to ""
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/lib64/libxc.a
-- Up-to-date: /home/ccspapp/Scratch/castep/castep_23.1.1_install/lib64/libxc.a
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/lib64/libxcf03.a
-- Installing: /home/ccspapp/Scratch/castep/castep_23.1.1_install/lib64/libxcf90.a
CMake Error at LibSource/libxc-5.2.2/cmake_install.cmake:92 (file):
  file INSTALL cannot find
  "/home/ccspapp/Scratch/castep/castep_23.1_install/build/LibSource/libxc-5.2.2/xc_f03_lib_m.mod":
  No such file or directory.
Call Stack (most recent call first):
  cmake_install.cmake:47 (include)


make: *** [Makefile:130: install] Error 1

Although I actually want it to use external libxc, so would need to pass it more things to make it do that. And tell Spack to build and use libxc 5.2.2 rather than 6.2.2 for this. [Actually, 5.2.3 - it only fixes one CUDA issue]

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 16, 2024

xc_f03_lib_m.mod does exist in build/mod now, but the install is trying to get it from build/LibSource/libxc-5.2.2.

Line 92 of LibSource/libxc-5.2.2/cmake_install.cmake is indeed trying to install from build/LibSource/libxc-5.2.2/xc_f03_lib_m.mod into "${CMAKE_INSTALL_PREFIX}/include".

I'll have a look at 24 since that fixed more things.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 16, 2024

Have to work out how to tell it that patches are in the source mirror (or anywhere on the local filesystem) rather than the package repo before I can install any versions via Spack.

==> Error: cannot load package 'castep' from the 'ucl.arc.hpc.dev' repository: FilePatch: Patch file Castep_23.1_build_fixes.diff.gz for package ucl.arc.hpc.dev.castep does not exist.

@heatherkellyucl
Copy link
Collaborator Author

The thing I was missing was that you don't also give the filename when you want it to be a UrlPatch:

    patch(
        f"file://{os.getcwd()}/Castep_23.1_build_fixes.diff.gz",
        sha256="a7860dc6677955d9bc877859666c4e8aa59635723968661674283a3939d7a66b",
        archive_sha256="5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2",
        when="@23.1.1",
    )

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 17, 2024

While Spack is building castep 24.1 with libxc using the existing recipe, I'm having a look at making 23.1.1 use an existing libxc.

While I'm at it, I should also add in python so it isn't looking at the system python2.

module load libxc/5.2.3/gcc-12.3.0
module load python/3.11.6/gcc-12.3.0

-DEXTERNAL_LIBXC_LIBRARY=ON (not recommended!) also needs adding for this. See if cmake then finds it.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 17, 2024

CASTEP 23.1.1 by hand with external libxc

cmake -B ../castep_23.1_install/build -DWITH_MPI=ON -DWITH_LIBXC=ON -DEXTERNAL_LIBXC_LIBRARY=ON -DCMAKE_INSTALL_PREFIX=../castep_23.1_install
Extralibs:
-- Fox CML: OFF
-- libxc found: /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/libxc-5.2.3-5nhmyelcaign3oojiprkng26oiteomc3/lib/libxc.so
-- Build type: FAST
-- spglib: BUILDING
-- dl_mg: BUILDING
-- dftd3: BUILDING
-- dftd4: BUILDING
-- QUIP: OFF
-- Could NOT find LATEX (missing: LATEX_COMPILER BIBTEX DVIPS)
-- f2py or f90wrap not found, castep_python unavailable
-- Setting parallelism to 4-way MPI with a total of 36
-- Found python as /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/python-3.11.6-jy3jbadp7rsw4six4ivtgk5dtimpkwfx/bin/python3.11

(Can consider the f2py later).

cd ../castep_23.1_install/build/
make

Now the same libxc mod file isn't found by OTFG. It exists in /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/libxc-6.2.2-wpzhhjgxdkufg4lygkxvrhosdijcoozj/include/ and we're setting CMAKE_PREFIX_PATH in our module but not CPATH or INCLUDE_PATH.

[ 25%] Building Fortran object Source/OTFG/CMakeFiles/otfg.dir/xc_kernels.f90.o
/home/ccspapp/Scratch/castep/CASTEP-23.1/Source/OTFG/xc_kernels.f90:6455:9:

 6455 |     use xc_f03_lib_m
      |         1
Fatal Error: Cannot open module file 'xc_f03_lib_m.mod' for reading at (1): No such file or directory
compilation terminated.
make[2]: *** [Source/OTFG/CMakeFiles/otfg.dir/build.make:205: Source/OTFG/CMakeFiles/otfg.dir/xc_kernels.f90.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:985: Source/OTFG/CMakeFiles/otfg.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

CASTEP 24.1 in Spack

Meanwhile, castep 24.1 which built its own libxc completes the build but has the same make install issue with the .mod file locations as I had previously.

==> Installing castep-24.1-tbupnjsvai35jtus65tkfd2eapxy2vox [101/103]
==> No binary for castep-24.1-tbupnjsvai35jtus65tkfd2eapxy2vox found: installing from source
==> Fetching file:///shared/ucl/apps/pkg-store/castep/castep-24.1.tar.gz
==> No patches needed for castep
==> castep: Executing phase: 'cmake'
==> castep: Executing phase: 'build'
==> castep: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j6' 'install'

2 errors found in build log:

  >> 3373    CMake Error at LibSource/libxc-5.2.3/cmake_install.cmake:92 (file):
     3374      file INSTALL cannot find
     3375      "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-24
             .1-tbupnjsvai35jtus65tkfd2eapxy2vox/spack-build-tbupnjs/LibSource/libxc-5.2.3/xc_f03_lib_m.mod":
     3376      No such file or directory.
     3377    Call Stack (most recent call first):
     3378      cmake_install.cmake:47 (include)
     3379
     3380
  >> 3381    make: *** [Makefile:133: install] Error 1

As with 23, they're all in spack-build-tbupnjs/mod after the make step instead, so this probably needs patching.

@heatherkellyucl
Copy link
Collaborator Author

LibSource/libxc-5.2.3/CMakeLists.txt install parts starts at line 513. In the fortran part there is:

if(ENABLE_FORTRAN)
  install(TARGETS xc xcf03 xcf90
    EXPORT f_interface
    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
  install(FILES "${PROJECT_BINARY_DIR}/xc_f03_lib_m.mod"
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${NAMESPACE_INSTALL_INCLUDEDIR})
  install(FILES "${PROJECT_BINARY_DIR}/xc_f90_lib_m.mod"
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${NAMESPACE_INSTALL_INCLUDEDIR})
  if(NOT MSVC)
    install(FILES ${PROJECT_BINARY_DIR}/libxcf03.pc
                  ${PROJECT_BINARY_DIR}/libxcf90.pc
      DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
  endif()
endif()

"${PROJECT_BINARY_DIR}/xc_f03_lib_m.mod" isn't where the mod file is.

@heatherkellyucl
Copy link
Collaborator Author

Looking through the generated build directory's CMakeCache.txt:

//Value Computed by CMake
CASTEP_BINARY_DIR:STATIC=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-24.1-tbupnjsvai35jtus65tkfd2eapxy2vox/spack-build-tbupnjs

//Value Computed by CMake
CASTEP_SOURCE_DIR:STATIC=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-24.1-tbupnjsvai35jtus65tkfd2eapxy2vox/spack-src

...

//Value Computed by CMake
Libxc_BINARY_DIR:STATIC=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-24.1-tbupnjsvai35jtus65tkfd2eapxy2vox/spack-build-tbupnjs/LibSource/libxc-5.2.3

//Value Computed by CMake
Libxc_IS_TOP_LEVEL:STATIC=OFF

//Value Computed by CMake
Libxc_SOURCE_DIR:STATIC=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-24.1-tbupnjsvai35jtus65tkfd2eapxy2vox/spack-src/LibSource/libxc-5.2.3

The mod files are all in $CASTEP_BINARY_DIR/mod.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 17, 2024

Assuming it is analogous to this:

CMAKE_SOURCE_DIR refers to the top-level source directory that contains a CMakeLists. txt , while PROJECT_SOURCE_DIR refers to the source directory of the most recent project() command

then I think it wants ${CMAKE_BINARY_DIR}/mod and not ${PROJECT_BINARY_DIR}

(If that exists and is usable here).

https://cmake.org/cmake/help/latest/variable/CMAKE_BINARY_DIR.html

The path to the top level of the build tree.

This is the full path to the top level of the current CMake build tree. For an in-source build, this would be the same as CMAKE_SOURCE_DIR.

When run in cmake -P script mode, CMake sets the variables CMAKE_BINARY_DIR, CMAKE_SOURCE_DIR, CMAKE_CURRENT_BINARY_DIR and CMAKE_CURRENT_SOURCE_DIR to the current working directory.

It is going to be safer to refer to $CASTEP_BINARY_DIR/mod, I will have to find out if libxc still knows about that or not.

@heatherkellyucl
Copy link
Collaborator Author

None of the other LibSource do this so it shouldn't be an issue for them.

@heatherkellyucl
Copy link
Collaborator Author

Added a patch, https://github.com/UCL-ARC/hpc-spack/blob/0.22/repos/dev/packages/castep/castep_cmake_libxc.patch - needs to be added to the package.py and tested with 23 and 24.

@heatherkellyucl
Copy link
Collaborator Author

Spack has built and installed CASTEP 24.1! With libxc, built by castep.

Now to see if it can 23.1 too without any additional changes.

@heatherkellyucl
Copy link
Collaborator Author

Got this for 23.1.1 - er, caching?

==> Installing castep-23.1.1-qzeblxq5jdhuwm3hwsr3pby5m3gtma4b [101/104]
==> No binary for castep-23.1.1-qzeblxq5jdhuwm3hwsr3pby5m3gtma4b found: installing from source
==> Fetching file:///shared/ucl/apps/pkg-store/castep/castep-23.1.1.tar.gz
==> Error: FetchError: Manual download is required for castep. Refer to http://castep.org for download instruc
tions.

I did update the checksums, and it is finding the source from our mirror but doesn't want to use it.

@heatherkellyucl
Copy link
Collaborator Author

Oh, maybe it is the versions, it untars as CASTEP-23.1 now and not 23.1.1.

@heatherkellyucl
Copy link
Collaborator Author

No that updated the hash but it still fails:

==> Installing castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2 [100/104]
==> No binary for castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2 found: installing from source
==> Fetching file:///shared/ucl/apps/pkg-store/castep/castep-23.1.tar.gz
==> Error: FetchError: Manual download is required for castep. Refer to http://castep.org for download instructions.

@heatherkellyucl
Copy link
Collaborator Author

It put it into /shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2/CASTEP-23.1.tar.gz and then stopped.

@heatherkellyucl
Copy link
Collaborator Author

Debug: checks for existence in the various caches and mirrors, and with hashes in the names - those are not expected to be found.

Does ==> [2024-09-18-12:41:08.286005] Fetching file:///shared/ucl/apps/pkg-store/castep/castep-23.1.tar.gz pretty early in this lot.

==> [2024-09-18-12:41:08.277618] Checking existence of file:///shared/ucl/apps/pkg-store/castep/castep-23.1.tar.gz
==> [2024-09-18-12:41:08.286005] Fetching file:///shared/ucl/apps/pkg-store/castep/castep-23.1.tar.gz
==> [2024-09-18-12:41:08.400952] Fetching from https://binaries.spack.io/develop/developer-tools-manylinux2014/_source-cache/archive/7f/7fba0450d3fd71586c8498ce51975bbdde923759ab298a656409280c29bf45b5.tar.gz failed.
==> [2024-09-18-12:41:08.401084] Fetching from https://binaries.spack.io/develop/developer-tools-manylinux2014/castep/castep-23.1.tar.gz failed.
==> [2024-09-18-12:41:08.401126] Fetching from file:///shared/ucl/apps/spack/0.22/buildcache/_source-cache/archive/7f/7fba0450d3fd71586c8498ce51975bbdde923759ab298a656409280c29bf45b5.tar.gz failed.
==> [2024-09-18-12:41:08.401221] Fetching from file:///shared/ucl/apps/spack/0.22/buildcache/castep/castep-23.1.tar.gz failed.
==> [2024-09-18-12:41:08.401267] Fetching from file:///shared/ucl/apps/pkg-store/_source-cache/archive/7f/7fba0450d3fd71586c8498ce51975bbdde923759ab298a656409280c29bf45b5.tar.gz failed.
==> [2024-09-18-12:41:08.402594] Checking existence of https://binaries.spack.io/develop/developer-tools-manylinux2014/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:08.745006] Failure reading URL: HEAD https://binaries.spack.io/develop/developer-tools-manylinux2014/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz returned 404: Not Found
==> [2024-09-18-12:41:08.745581] URL does not exist: https://binaries.spack.io/develop/developer-tools-manylinux2014/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:08.746209] FailedDownloadError: Failed to fetch file from URL: https://binaries.spack.io/develop/developer-tools-manylinux2014/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:08.746724] Checking existence of https://binaries.spack.io/develop/developer-tools-manylinux2014/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz 
==> [2024-09-18-12:41:09.082406] Failure reading URL: HEAD https://binaries.spack.io/develop/developer-tools-manylinux2014/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz returned 404: Not Found
==> [2024-09-18-12:41:09.082835] URL does not exist: https://binaries.spack.io/develop/developer-tools-manylinux2014/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz   
==> [2024-09-18-12:41:09.083382] FailedDownloadError: Failed to fetch file from URL: https://binaries.spack.io/develop/developer-tools-manylinux2014/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:09.083786] Checking existence of file:///shared/ucl/apps/spack/0.22/buildcache/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.084537] Failure reading URL: <urlopen error [Errno 2] No such file or directory: '/shared/ucl/apps/spack/0.22/buildcache/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz'>
==> [2024-09-18-12:41:09.084871] URL does not exist: file:///shared/ucl/apps/spack/0.22/buildcache/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.085435] FailedDownloadError: Failed to fetch file from URL: file:///shared/ucl/apps/spack/0.22/buildcache/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.085969] Checking existence of file:///shared/ucl/apps/spack/0.22/buildcache/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:09.086559] Failure reading URL: <urlopen error [Errno 2] No such file or directory: '/shared/ucl/apps/spack/0.22/buildcache/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz'>
==> [2024-09-18-12:41:09.086789] URL does not exist: file:///shared/ucl/apps/spack/0.22/buildcache/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:09.087219] FailedDownloadError: Failed to fetch file from URL: file:///shared/ucl/apps/spack/0.22/buildcache/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:09.087649] Checking existence of file:///shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.088269] Failure reading URL: <urlopen error [Errno 2] No such file or directory: '/shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz'>
==> [2024-09-18-12:41:09.088559] URL does not exist: file:///shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.088269] Failure reading URL: <urlopen error [Errno 2] No such file or directory: '/shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz'>
==> [2024-09-18-12:41:09.088559] URL does not exist: file:///shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.089049] FailedDownloadError: Failed to fetch file from URL: file:///shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.089538] Checking existence of file:///shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:09.090064] Failure reading URL: <urlopen error [Errno 2] No such file or directory: '/shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz'>
==> [2024-09-18-12:41:09.090259] URL does not exist: file:///shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:09.090656] FailedDownloadError: Failed to fetch file from URL: file:///shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz 
==> [2024-09-18-12:41:09.091030] Checking existence of https://mirror.spack.io/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.631688] Failure reading URL: HEAD https://mirror.spack.io/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz returned 404: Not Found
==> [2024-09-18-12:41:09.632124] URL does not exist: https://mirror.spack.io/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.632677] FailedDownloadError: Failed to fetch file from URL: https://mirror.spack.io/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz
==> [2024-09-18-12:41:09.633083] Checking existence of https://mirror.spack.io/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:10.180514] Failure reading URL: HEAD https://mirror.spack.io/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz returned 404: Not Found
==> [2024-09-18-12:41:10.180880] URL does not exist: https://mirror.spack.io/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:10.181360] FailedDownloadError: Failed to fetch file from URL: https://mirror.spack.io/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> [2024-09-18-12:41:10.181710] Checking existence of file:///lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/Castep_23.1_build_fixes.diff.gz
==> [2024-09-18-12:41:10.182276] Failure reading URL: <urlopen error [Errno 2] No such file or directory: '/lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/Castep_23.1_build_fixes.diff.gz'>
==> [2024-09-18-12:41:10.182511] URL does not exist: file:///lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/Castep_23.1_build_fixes.diff.gz
==> [2024-09-18-12:41:10.182929] FailedDownloadError: Failed to fetch file from URL: file:///lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/Castep_23.1_build_fixes.diff.gz
==> [2024-09-18-12:41:10.183161] Fetching from https://binaries.spack.io/develop/developer-tools-manylinux2014/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz failed.
==> [2024-09-18-12:41:10.183428] Fetching from https://binaries.spack.io/develop/developer-tools-manylinux2014/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz failed. 
==> [2024-09-18-12:41:10.183597] Fetching from file:///shared/ucl/apps/spack/0.22/buildcache/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz failed.
==> [2024-09-18-12:41:10.183918] Fetching from file:///shared/ucl/apps/spack/0.22/buildcache/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz failed.
==> [2024-09-18-12:41:10.184125] Fetching from file:///shared/ucl/apps/pkg-store/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz failed.
==> [2024-09-18-12:41:10.184395] Fetching from file:///shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz failed.
==> [2024-09-18-12:41:10.184561] Fetching from https://mirror.spack.io/_source-cache/archive/5f/5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2.gz failed.
==> [2024-09-18-12:41:10.184734] Fetching from https://mirror.spack.io/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz failed.
==> [2024-09-18-12:41:10.184840] Fetching from file:///lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/Castep_23.1_build_fixes.diff.gz failed.
==> [2024-09-18-12:41:10.199753] Error: FetchError: Manual download is required for castep. Refer to http://castep.org for download instructions.
Traceback (most recent call last):
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/build_environment.py", line 1151, in _setup_pkg_and_run
    return_value = function(pkg, kwargs)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/installer.py", line 2482, in build_process
    return installer.run()
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/installer.py", line 2331, in run
    self.pkg.do_patch()
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/package_base.py", line 1533, in do_patch
    self.do_stage()
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/package_base.py", line 1521, in do_stage
    self.do_fetch(mirror_only)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/package_base.py", line 1505, in do_fetch
    self.stage.fetch(mirror_only, err_msg=err_msg)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/util/pattern.py", line 16, in __call__
    return [getattr(item, self.name)(*args, **kwargs) for item in self.container]
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/util/pattern.py", line 16, in <listcomp>
    return [getattr(item, self.name)(*args, **kwargs) for item in self.container]
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/stage.py", line 562, in fetch
    raise spack.error.FetchError(err_msg or default_msg, None)
spack.error.FetchError: Manual download is required for castep. Refer to http://castep.org for download instructions.
==> [2024-09-18-12:41:10.200988] Flagging castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2 as failed: FetchError: Manual download is required for castep. Refer to http://castep.org for download instructions.
==> [2024-09-18-12:41:10.225223] Downgrading to a read lock on castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2 with timeout 1.000ns
==> [2024-09-18-12:41:10.225422] castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2 is now read locked
...
==> [2024-09-18-12:41:10.273850] Releasing read lock on castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2
==> [2024-09-18-12:41:10.274679] Error: castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2: FetchError: Manual download is required for castep. Refer to http://castep.org for download instructions.
==> [2024-09-18-12:41:10.274708] Error: castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2: Package was not installed
==> [2024-09-18-12:41:10.274728] Associating installation failure with first failed explicit package (castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2) from castep-23.1-s4ypamfv2gzuc34al3i6kjxz73l3zll2
==> [2024-09-18-12:41:10.274833] InstallError: Installation request failed.  Refer to reported errors for failing package(s).
==> [2024-09-18-12:41:10.274852] Error: Installation request failed.  Refer to reported errors for failing package(s).
Traceback (most recent call last):
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/main.py", line 1069, in main
    return _main(argv)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/main.py", line 1022, in _main
    return finish_parse_and_run(parser, cmd_name, args, env_format_error)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/main.py", line 1052, in finish_parse_and_run
    return _invoke_command(command, parser, args, unknown) 
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/main.py", line 649, in _invoke_command
    return_val = command(parser, args)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/cmd/install.py", line 352, in install
    install_with_active_env(env, args, install_kwargs, reporter_factory)
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/cmd/install.py", line 421, in install_with_active_env
    env.install_specs(specs_to_install, **install_kwargs)  
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/environment/environment.py", line 1957, in install_specs
    PackageInstaller(installs).install()
  File "/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/lib/spack/spack/installer.py", line 2252, in install
    raise InstallError(
spack.installer.InstallError: Installation request failed.  Refer to reported errors for failing package(s).

@heatherkellyucl
Copy link
Collaborator Author

It appears to be /shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz which is the problem because it is only trying to get file:///shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz ?

@heatherkellyucl
Copy link
Collaborator Author

Ok, it makes /shared/ucl/apps/spack/0.22/hk-initial-stack/build_stage/ccspapp/spack-stage-patch-5f31daf4733f8ee906cba0ff092e317b9cbaa100666533b2dce39f1f829646c2 at the same time and does not put anything into it.

I put a renamed copy of the patch file with the short hash into /shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz where it was looking and then it can proceed.

Now I need to make 23.1 its own castep_cmake_libxc.patch because it is libxc 5.2.2 there and not 5.2.3 so the directory is different.

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 18, 2024

23.1 is also successfully built and has both Castep's patch and my patch applied.

==> Installing castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo [103/104]
==> No binary for castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo found: installing from source
==> Fetching file:///shared/ucl/apps/pkg-store/castep/castep-23.1.tar.gz
==> Fetching file:///shared/ucl/apps/pkg-store/castep/Castep_23.1_build_fixes.diff.gz-5f31daf.gz
==> Applied patch file:///lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/Castep_23.1_build_fixes.diff.gz
==> Applied patch /lustre/scratch/scratch/ccspapp/spack/0.22/hpc-spack/repos/dev/packages/castep/castep_cmake_libxc522.patch
==> castep: Executing phase: 'cmake'
==> castep: Executing phase: 'build'
==> castep: Executing phase: 'install'
==> castep: Successfully installed castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo
  Stage: 18.41s.  Cmake: 1m 48.79s.  Build: 9m 23.49s.  Install: 5.51s.  Post-install: 1.39s.  Total: 11m 43.42s

@heatherkellyucl
Copy link
Collaborator Author

Testing 24.1 including mpi:

cd /home/ccspapp/Scratch/castep/CASTEP-24.1/Test
make CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-24.1-c2u26cbdn7nrrq4qt3me4acvtr2cdfrp/bin/castep.mpi COMMS_ARCH=mpi
Found mpirun, using PARALLEL_CMD=mpirun -np tc.nprocs
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --processors=4 --total-processors=36 --user-option castep run_cmd_template "../../../bin/run_castep_test.pl tc.program tc.args tc.input tc.output mpirun -np tc.nprocs" -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-24.1-c2u26cbdn7nrrq4qt3me4acvtr2cdfrp/bin/castep.mpi -c simple -c d3-simple -c d4-simple -c solvation-simple -c md-parallel
................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................ [496/496]

Last night I accidentally ran the castep 23.1 binary with 24.1's tests and got 20 failures (476/496 passed). Which is actually slightly reassuring.

Then the libxc tests:

make check-libxc CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-24.1-c2u26cbdn7nrrq4qt3me4acvtr2cdfrp/bin/castep.mpi COMMS_ARCH=mpi
Found mpirun, using PARALLEL_CMD=mpirun -np tc.nprocs
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --processors=4 --total-processors=36 --user-option castep run_cmd_template "../../../bin/run_castep_test.pl tc.program tc.args tc.input tc.output mpirun -np tc.nprocs" -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-24.1-c2u26cbdn7nrrq4qt3me4acvtr2cdfrp/bin/castep.mpi -c libxc-simple
.... [4/4]

@heatherkellyucl
Copy link
Collaborator Author

23.1 also passes:

cd /home/ccspapp/Scratch/castep/CASTEP-23.1/Test
make CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo/bin/castep.mpi COMMS_ARCH=mpi
Found mpirun, using PARALLEL_CMD=mpirun -np tc.nprocs
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --processors=4 --total-processors=36 --user-option castep run_cmd_template "../../../bin/run_castep_test.pl tc.program tc.args tc.input tc.output mpirun -np tc.nprocs" -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo/bin/castep.mpi -c simple -c d3-simple -c d4-simple -c md-parallel
....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................... [487/487]
make check-libxc CASTEPEXE=/lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo/bin/castep.mpi COMMS_ARCH=mpi
Found mpirun, using PARALLEL_CMD=mpirun -np tc.nprocs
rm -f */*/*.castep */*/*.dfpt_wvfn */*/*.fd_wvfn */*/*.wvfn.* */*/*.*.err
../bin/testcode.py -q  --processors=4 --total-processors=36 --user-option castep run_cmd_template "../../../bin/run_castep_test.pl tc.program tc.args tc.input tc.output mpirun -np tc.nprocs" -e /lustre/shared/ucl/apps/spack/0.22/hk-initial-stack/spack/opt/spack/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/__spack_path_placeholder__/linux-rhel7-cascadelake/gcc-12.3.0/castep-23.1-5ed5smvptchqxptpm737r6cfhzuxeyvo/bin/castep.mpi -c libXC-simple
.. [2/2]

@heatherkellyucl
Copy link
Collaborator Author

heatherkellyucl commented Sep 19, 2024

I have added castep 23 and 24 +libxc into base.yaml.

Things that still need doing in the recipe:

  • check if any of the Makefile alterations still need to be made for 23 up.
  • add quip variant and test it (stretch goal)
  • add foxcml recipe, variant and test it (stretchier goal)
  • pull request to Spack with the updated recipe

@heatherkellyucl heatherkellyucl changed the title CASTEP 23.1.1 CASTEP 23.1.1 and CASTEP 24.1 Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants