Skip to content

Optimized Cantera build with the LLVM-based Intel compilers do not work correctly #1150

@tpg2114

Description

@tpg2114

I know the compilation instructions recommend against the Intel compilers, but the now-called classic Intel compilers icc and icpc have worked for us over the past year. However, the new LLVM-based compilers icx and icpx in the Intel oneAPI 2021 release are causing issues for us.

When the optimize=y flag is passed to scons and the icx, icpx, and ifort compilers are used, all of the thermodynamic routines return nonsense results:

>>> gas2 = cantera.Solution('gri30.cti')
>>> gas2.partial_molar_cp
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
       0., 0.])
>>> gas2.partial_molar_entropies
array([-1.84618157e-12,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06,  5.74342730e+06,  5.74342730e+06,  5.74342730e+06,
        5.74342730e+06])

Rebuilding with optimize=n gives logical results:

>>> gas.partial_molar_cp
array([28850.78499483, 20786.1565461 , 21900.310829  , 29388.07113248, 
       29877.9662108 , 33596.45144474, 34929.99364444, 42458.34282025, 
       20837.772867  , 29175.01279838, 35041.92327681, 33796.1755915 , 
       38476.66517763, 35760.53544168, 29143.05598224, 37217.74697861, 
       34620.17089036, 35443.46293798, 48473.38874297, 37990.95184739, 
       44154.86358601, 42047.04769266, 44134.49205447, 42846.9589907 , 
       43054.5662317 , 50667.04415886, 52719.37349824, 48539.96252103, 
       51898.37630042, 58510.53771334, 20786.15654538, 29192.46893339, 
       33869.64884343, 35699.25554991, 34695.31836395, 29858.13985786, 
       37234.10116356, 38710.67916751, 33901.48770831, 29158.80082924, 
       35925.14870757, 38337.31040521, 49223.39253868, 46913.04968495, 
       46367.88873358, 46574.66814261, 40180.03990305, 29075.48227818, 
       20786.15654538, 71585.98993627, 73950.0234428 , 55131.64313731, 
       55506.3227774 ])
>>> 

Building with g++, gcc, and ifort with optimize=y gives the right answers, as does icpc, icc, and ifort.

We can deal with the workaround of using the GNU compilers for C and C++ or the classic Intel compilers, but I thought I'd bring it to your attention because the classic compilers will be retired and mixing the GNU compilers and Intel is messy on many of the HPC machines we use, so the workaround is not always trivial to implement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions