77from importlib .resources import path
88from configparser import ConfigParser
99
10- from mache import discover_machine , MachineInfo
11- from mache .spack import make_spack_env , get_spack_script
10+ from mache import discover_machine
11+ from mache .spack import make_spack_env , get_spack_script , \
12+ get_modules_env_vars_and_mpi_compilers
1213from mache .version import __version__ as mache_version
1314from mache .permissions import update_permissions
1415from shared import parse_args , check_call , install_miniconda , get_conda_base
@@ -116,8 +117,7 @@ def build_env(is_test, recreate, compiler, mpi, conda_mpi, version,
116117 if nco_dev :
117118 channels = f'{ channels } -c conda-forge/label/nco_dev'
118119 channels = f'{ channels } -c conda-forge/label/e3sm_dev ' \
119- f'-c conda-forge -c defaults -c e3sm/label/e3sm_dev ' \
120- f'-c e3sm'
120+ f'-c conda-forge -c defaults -c e3sm/label/e3sm_dev -c e3sm'
121121 else :
122122 channels = '--override-channels -c conda-forge -c defaults -c e3sm'
123123
@@ -149,24 +149,23 @@ def build_env(is_test, recreate, compiler, mpi, conda_mpi, version,
149149 return env_path , env_name , activate_env , channels , spack_env
150150
151151
152- def build_sys_ilamb (config , machine_info , compiler , mpi , template_path ,
152+ def build_sys_ilamb (config , machine , compiler , mpi , template_path ,
153153 activate_env , channels ):
154154
155155 mpi4py_version = config .get ('e3sm_unified' , 'mpi4py' )
156156 ilamb_version = config .get ('e3sm_unified' , 'ilamb' )
157157 build_mpi4py = str (mpi4py_version != 'None' )
158158 build_ilamb = str (ilamb_version != 'None' )
159159
160- mpicc , _ , _ , mod_commands , _ = \
161- machine_info .get_modules_and_mpi_compilers (compiler , mpi )
160+ mpicc , _ , _ , modules = \
161+ get_modules_env_vars_and_mpi_compilers (machine , compiler , mpi ,
162+ shell = 'sh' )
162163
163164 script_filename = 'build.bash'
164165
165166 with open (f'{ template_path } /build.template' , 'r' ) as f :
166167 template = Template (f .read ())
167168
168- modules = '\n ' .join (mod_commands )
169-
170169 # need to activate the conda environment to install mpi4py and ilamb, and
171170 # possibly for compilers and MPI library (if not on a supported machine)
172171 activate_env_lines = activate_env .replace ('; ' , '\n ' )
@@ -185,7 +184,7 @@ def build_sys_ilamb(config, machine_info, compiler, mpi, template_path,
185184 check_call (command )
186185
187186
188- def build_spack_env (config , machine , compiler , mpi , spack_env ):
187+ def build_spack_env (config , machine , compiler , mpi , spack_env , tmpdir ):
189188
190189 base_path = config .get ('e3sm_unified' , 'base_path' )
191190 spack_base = f'{ base_path } /spack/spack_for_mache_{ mache_version } '
@@ -199,7 +198,7 @@ def build_spack_env(config, machine, compiler, mpi, spack_env):
199198
200199 make_spack_env (spack_path = spack_base , env_name = spack_env ,
201200 spack_specs = specs , compiler = compiler , mpi = mpi ,
202- machine = machine )
201+ machine = machine , tmpdir = tmpdir , include_e3sm_lapack = True )
203202
204203 return spack_base
205204
@@ -282,8 +281,7 @@ def check_env(script_filename, env_name, conda_mpi, machine):
282281 commands = [['mpas_analysis' , '-h' ],
283282 ['livv' , '--version' ],
284283 ['globus' , '--help' ],
285- ['zstash' , '--help' ],
286- ['processflow' , '-v' ]]
284+ ['zstash' , '--help' ]]
287285
288286 if machine is None :
289287 # on HPC machines, these only work on compute nodes because of mpi4py
@@ -324,11 +322,6 @@ def main():
324322 machine = discover_machine ()
325323 print (f'discovered: { machine } ' )
326324
327- if machine is not None :
328- machine_info = MachineInfo (machine = machine )
329- else :
330- machine_info = None
331-
332325 config = get_config (args .config_file , machine )
333326
334327 if args .release :
@@ -376,8 +369,9 @@ def main():
376369 env_vars = ['export HDF5_USE_FILE_LOCKING=FALSE' ])
377370
378371 if compiler is not None :
379- spack_base = build_spack_env (config , machine , compiler , mpi , spack_env )
380- build_sys_ilamb (config , machine_info , compiler , mpi , template_path ,
372+ spack_base = build_spack_env (config , machine , compiler , mpi , spack_env ,
373+ args .tmpdir , )
374+ build_sys_ilamb (config , machine , compiler , mpi , template_path ,
381375 activate_env , channels )
382376 else :
383377 spack_base = None
0 commit comments