Skip to content

Commit

Permalink
Set oneapi_fortran=True by default for Intel 2024.0.0+
Browse files Browse the repository at this point in the history
ifort is deprecated, so default to ifx
  • Loading branch information
bartoldeman committed Jun 27, 2024
1 parent 5f00b71 commit 401cdd8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
6 changes: 5 additions & 1 deletion easybuild/toolchains/compiler/intel_compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class IntelCompilers(IntelIccIfort):
'oneapi': (None, "Use oneAPI compilers icx/icpx/ifx instead of classic compilers"),
'oneapi_c_cxx': (None, "Use oneAPI C/C++ compilers icx/icpx instead of classic Intel C/C++ compilers "
"(auto-enabled for Intel compilers version 2022.2.0, or newer)"),
'oneapi_fortran': (False, "Use oneAPI Fortran compiler ifx instead of classic Intel Fortran compiler"),
'oneapi_fortran': (None, "Use oneAPI Fortran compiler ifx instead of classic Intel Fortran compiler "
"(auto-enabled for Intel compilers version 2024.0.0, or newer)"),
})

def _set_compiler_vars(self):
Expand All @@ -75,6 +76,9 @@ def set_variables(self):
# auto-enable use of oneAPI C/C++ compilers for sufficiently recent versions of Intel compilers
comp_ver = self.get_software_version(self.COMPILER_MODULE_NAME)[0]
if LooseVersion(comp_ver) >= LooseVersion('2022.2.0'):
if LooseVersion(comp_ver) >= LooseVersion('2024.0.0'):
if self.options.get('oneapi_fortran', None) is None:
self.options['oneapi_fortran'] = True
if self.options.get('oneapi_c_cxx', None) is None:
self.options['oneapi_c_cxx'] = True

Expand Down
31 changes: 31 additions & 0 deletions test/framework/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,37 @@ def test_intel_toolchain_oneapi(self):
self.assertEqual(os.getenv('F90'), 'ifx')
self.assertEqual(os.getenv('FC'), 'ifx')

self.modtool.purge()
tc = self.get_toolchain('intel-compilers', version='2024.0.0')
tc.prepare()

# by default (for version >= 2024.0.0): oneAPI C/C++ compiler + oneAPI Fortran compiler
self.assertEqual(os.getenv('CC'), 'icx')
self.assertEqual(os.getenv('CXX'), 'icpx')
self.assertEqual(os.getenv('F77'), 'ifx')
self.assertEqual(os.getenv('F90'), 'ifx')
self.assertEqual(os.getenv('FC'), 'ifx')

self.modtool.purge()
tc = self.get_toolchain('intel-compilers', version='2024.0.0')
tc.set_options({'oneapi_fortran': False})
tc.prepare()
self.assertEqual(os.getenv('CC'), 'icx')
self.assertEqual(os.getenv('CXX'), 'icpx')
self.assertEqual(os.getenv('F77'), 'ifort')
self.assertEqual(os.getenv('F90'), 'ifort')
self.assertEqual(os.getenv('FC'), 'ifort')

self.modtool.purge()
tc = self.get_toolchain('intel-compilers', version='2024.0.0')
tc.set_options({'oneapi_c_cxx': False, 'oneapi_fortran': False})
tc.prepare()
self.assertEqual(os.getenv('CC'), 'icc')
self.assertEqual(os.getenv('CXX'), 'icpc')
self.assertEqual(os.getenv('F77'), 'ifort')
self.assertEqual(os.getenv('F90'), 'ifort')
self.assertEqual(os.getenv('FC'), 'ifort')

self.modtool.purge()
tc = self.get_toolchain('intel', version='2021b')
tc.set_options({'oneapi_c_cxx': True})
Expand Down

0 comments on commit 401cdd8

Please sign in to comment.