# How to build ACCESS-OM2 on Gadi using Intel OneAPI compilers?

**URL:** <https://forum.access-hive.org.au/t/how-to-build-access-om2-on-gadi-using-intel-oneapi-compilers/1574>\
**Category:** spack\
**Tags:** spack, access-om2\
**Created:** [3 November 2023 01:21 UTC](https://forum.access-hive.org.au/t/how-to-build-access-om2-on-gadi-using-intel-oneapi-compilers/1574 "2023-11-03T01:21:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulleopardi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paulleopardi/32/92_2.png) [@paulleopardi](https://forum.access-hive.org.au/u/paulleopardi)\
**Post date:** [3 November 2023 01:21 UTC](https://forum.access-hive.org.au/t/how-to-build-access-om2-on-gadi-using-intel-oneapi-compilers/1574/1 "2023-11-03T01:21:02Z")

</div>

Thanks. I tried adding the `intel-compiler-llvm` compilers as follows:

```auto
module load intel-compiler-llvm/2023.2.0
spack compiler find
spack compiler list
module unload intel-compiler-llvm
gvim ~/.spack/linux/compilers.yaml 

```

where in the last step I added `intel-compiler-llvm/2023.2.0` to `modules:` in `~/.spack/linux/compilers.yaml`, resulting in

```auto
- compiler:
    spec: dpcpp@=2023.2.0
    paths:
      cc: /apps/intel-ct/wrapper/icx
      cxx: /apps/intel-ct/wrapper/dpcpp
      f77: /apps/intel-ct/wrapper/ifx
      fc: /apps/intel-ct/wrapper/ifx
    flags: {}
    operating_system: rocky8
    target: x86_64
    modules: [intel-compiler-llvm/2023.2.0]
    environment: {}
    extra_rpaths: []
- compiler:
    spec: intel@=2021.10.0
    paths:
      cc: /apps/intel-ct/wrapper/icc
      cxx: /apps/intel-ct/wrapper/icpc
      f77: /apps/intel-ct/wrapper/ifort
      fc: /apps/intel-ct/wrapper/ifort
    flags: {}
    operating_system: rocky8
    target: x86_64
    modules: [intel-compiler-llvm/2023.2.0]
    environment: {}
    extra_rpaths: []
- compiler:
    spec: oneapi@=2023.2.0
    paths:
      cc: /apps/intel-ct/wrapper/icx
      cxx: /apps/intel-ct/wrapper/icpx
      f77: /apps/intel-ct/wrapper/ifx
      fc: /apps/intel-ct/wrapper/ifx
    flags: {}
    operating_system: rocky8
    target: x86_64
    modules: [intel-compiler-llvm/2023.2.0]
    environment: {}
    extra_rpaths: []

```

I then tried running

```auto
spack install access-om2 ^netcdf-c@4.7.4 ^netcdf-fortran@4.5.2 ^nci-openmpi@4.0.2 %oneapi@2023.2.0

```

This resulted in

```auto
...
==> Installing hdf5-1.14.1-2-dxvrriitqufyohygaxnlreh65edcbc2w
==> No binary for hdf5-1.14.1-2-dxvrriitqufyohygaxnlreh65edcbc2w found: installing from source
==> Error: UnboundLocalError: local variable 'finc_path' referenced before assignment

/g/data/tm70/pcl851/spack_packages/packages/nci-openmpi/package.py:37, in setup_run_environment:
         34 elif self.spec.satisfies("%gcc"):
         35 finc_path = join_path(self.prefix.include, "GNU")
         36 flib_path = join_path(self.prefix.lib, "GNU")
  >> 37 env.append_path("OMPI_FCFLAGS", "-I" + finc_path)
         38 env.append_path("OMPI_LDFLAGS", "-L" + self.prefix.lib + " -L" + flib_path)
...
==> Error: access-om2-2023.01.001-1-6djggb4u5qwdkd2u2jsq3n2yqsq4pvkw: Package was not installed
==> Error: Installation request failed. Refer to reported errors for failing package(s)

```

I then changed

```auto
    spec: oneapi@=2023.2.0

```

to

```auto
    spec: intel@=2023.2.0

```

in `~/.spack/linux/compilers.yaml` and ran

```auto
spack install access-om2 ^netcdf-c@4.7.4 ^netcdf-fortran@4.5.2 ^nci-openmpi@4.0.2 %intel@2023.2.0

```

This resulted in

```auto
==> Installing datetime-fortran-1.7.0-beeyadgfmab4a4gfg5hakzbfz25crehe
==> No binary for datetime-fortran-1.7.0-beeyadgfmab4a4gfg5hakzbfz25crehe found: installing from source
==> Using cached archive: /g/data/tm70/pcl851/spack/var/spack/cache/_source-cache/archive/cf/cff4c1f53af87a9f8f31256a3e04176f887cc3e947a4540481ade4139baf0d6f.tar.gz
==> Applied patch /g/data/tm70/pcl851/spack_packages/packages/datetime-fortran/0001-Enable-deterministic-builds-using-D-flag-for-ar.patch
==> datetime-fortran: Executing phase: 'autoreconf'
==> datetime-fortran: Executing phase: 'configure'
==> Error: ProcessError: Command exited with status 77:
    '/scratch/tm70/pcl851/tmp/spack-stage/spack-stage-datetime-fortran-1.7.0-beeyadgfmab4a4gfg5hakzbfz25crehe/spack-src/configure' '--prefix=/g/data/tm70/pcl851/spack/opt/spack/linux-rocky8-x86_64/intel-2023.2.0/datetime-fortran-1.7.0-beeyadgfmab4a4gfg5hakzbfz25crehe'

2 errors found in build log:
     10 checking for gawk... gawk
     11 checking whether make sets $(MAKE)... yes
     12 checking whether make supports nested variables... yes
     13 checking for pkg-config... /bin/pkg-config
     14 checking pkg-config is at least version 0.9.0... yes
     15 checking whether the Fortran compiler works... no
  >> 16 configure: error: in `/scratch/tm70/pcl851/tmp/spack-stage/spack-stage-datetime-fortran-1.7.0-beeyadgfmab4a4gfg5hakzbfz25crehe/spack
           -src':
  >> 17 configure: error: Fortran compiler cannot create executables
     18 See `config.log' for more details

See build log for details:
  /scratch/tm70/pcl851/tmp/spack-stage/spack-stage-datetime-fortran-1.7.0-beeyadgfmab4a4gfg5hakzbfz25crehe/spack-build-out.txt
...
==> Error: access-om2-2023.01.001-1-knirvpjz2oyt4l7ii6gsysqczntopkge: Package was not installed
==> Error: Installation request failed. Refer to reported errors for failing package(s)

```

It looks like I have missed a step. How do I clean up a failed build so that the next attempt does not ry to use cached builds? Also, is it correct to just change `oneapi` to `intel` in `~/.spack/linux/compilers.yaml` or do I need to do something else?

---

<div class="post-metadata">

**Author:** ![harshula](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/harshula/32/256_2.png) [@harshula](https://forum.access-hive.org.au/u/harshula)\
**Post date:** [3 November 2023 01:35 UTC](https://forum.access-hive.org.au/t/how-to-build-access-om2-on-gadi-using-intel-oneapi-compilers/1574/2 "2023-11-03T01:35:23Z")

</div>

Thanks for testing with the OneAPI compiler. I’ll investigate this soon.

---

<div class="post-metadata">

**Author:** ![harshula](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/harshula/32/256_2.png) [@harshula](https://forum.access-hive.org.au/u/harshula)\
**Post date:** [10 November 2023 06:15 UTC](https://forum.access-hive.org.au/t/how-to-build-access-om2-on-gadi-using-intel-oneapi-compilers/1574/3 "2023-11-10T06:15:39Z")

</div>

> [@paulleopardi](#):
>
> How do I clean up a failed build so that the next attempt does not ry to use cached builds?

Spack automatically cleans up the `spack-stage-<PACKAGENAME-VERSION-HASH>` directory the next time you try to compile the same package.

> [@paulleopardi](#):
>
> Also, is it correct to just change `oneapi` to `intel` in `~/.spack/linux/compilers.yaml` or do I need to do something else?

I’ve done this in the past as a hack. 😃 We should not do that, I need to fix the SPDs to understand the string “oneapi”. I’ve created an issue: [Support intel-compiler-llvm compilers · Issue #52 · ACCESS-NRI/spack\_packages · GitHub](https://github.com/ACCESS-NRI/spack_packages/issues/52)

---

<div class="post-metadata">

**Author:** ![paulleopardi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/paulleopardi/32/92_2.png) [@paulleopardi](https://forum.access-hive.org.au/u/paulleopardi)\
**Post date:** [15 November 2023 03:11 UTC](https://forum.access-hive.org.au/t/how-to-build-access-om2-on-gadi-using-intel-oneapi-compilers/1574/4 "2023-11-15T03:11:56Z")

</div>

Thanks for this.
