Skip to content

Commit

Permalink
Add claw back into ICON
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Stellio committed Aug 30, 2024
1 parent 061466f commit 58159b7
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions repos/c2sm/packages/icon-ham/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@

class IconHam(C2SMIcon):

claw_values = ('std', 'validate')
variant('claw',
default='none',
values=('none', ) + claw_values,
description='Enable CLAW preprocessing')

for x in claw_values:
depends_on('claw', type='build', when='claw={0}'.format(x))

conflicts('claw=validate', when='serialization=none')

for x in claw_values:
conflicts('+sct', when='claw={0}'.format(x))

@run_before('build')
def generate_hammoz_nml(self):
with working_dir(self.configure_directory +
Expand All @@ -13,7 +27,34 @@ def generate_hammoz_nml(self):
def configure_args(self):
args = super().configure_args()

claw = self.spec.variants['claw'].value
if claw == 'none':
args.append('--disable-claw')
else:
args.extend([
'--enable-claw={0}'.format(claw),
'CLAW={0}'.format(self.spec['claw'].prefix.bin.clawfc)
])
flags['CLAWFLAGS'].append(
self.spec['netcdf-fortran'].headers.include_flags)
if '+cdi-pio' in self.spec:
flags['CLAWFLAGS'].append(
self.spec['libcdi-pio'].headers.include_flags)

args.append('--enable-atm-phy-echam-submodels')
args.append('--enable-hammoz')

return args

def build(self, spec, prefix):
claw = self.spec.variants['claw'].value
if claw != 'none' and make_jobs > 8:
# Limit CLAW preprocessing to 8 parallel jobs to avoid
# claw_f_lib.sh: fork: retry: Resource temporarily unavailable
# ...
# Error: Could not create the Java Virtual Machine.
# Error: A fatal exception has occurred. Program will exit.
make.jobs = 8
make('preprocess')
make.jobs = make_jobs
make(*self.build_targets)

0 comments on commit 58159b7

Please sign in to comment.