Recently, I discovered that certain PGI compilers (pgf77 and pgf90) were unable to build HDF4, while newer ones (pgfortran) had no trouble. I submitted PR #493 to solve this issue. Now, if your compilers.yaml contains something like:
[email protected]:
cc: /soft/pgi/15.10/linux86-64/15.10/bin/pgcc
cxx: /soft/pgi/15.10/linux86-64/15.10/bin/pgc++
f77: /soft/pgi/15.10/linux86-64/15.10/bin/pgfortran
fc: /soft/pgi/15.10/linux86-64/15.10/bin/pgfortran
HDF4 will build for you. However, when I run:
spack compiler add /soft/pgi/15.10/linux86-64/15.10/bin
Spack still finds the older compilers first:
[email protected]:
cc: /soft/pgi/15.10/linux86-64/15.10/bin/pgcc
cxx: /soft/pgi/15.10/linux86-64/15.10/bin/pgCC
f77: /soft/pgi/15.10/linux86-64/15.10/bin/pgf77
fc: /soft/pgi/15.10/linux86-64/15.10/bin/pgf90
The PGI Installation Guide recommends using the newer compilers, although the older ones are kept around for backwards compatibility. Although I could simply remove pgCC, pgf77, and pgf90 from those lists, it would cause problems for anyone using older installations of PGI, which don't come with the newer compilers.
I propose we change the way that spack compiler add finds compilers. My suggestion would be to choose the first match it finds in cxx_names, f77_names, and f90_names. I believe the relevant code is in the find method of lib/spack/spack/compiler.py. Things start to get complicated since we also need to be able to find compilers with prefixes, suffixes, or version numbers, and much of the code is parallelized for efficiency.
If anyone would like to tackle this, and maybe wrap in a solution to any of the unresolved problems we've been seeing with Apple compilers, be my guest. Otherwise, I will hopefully get to it eventually. It doesn't significantly impact me since I can just spack config edit compilers and switch it over to the newer ones, but it might trip up a new Spack user.
Recently, I discovered that certain PGI compilers (
pgf77andpgf90) were unable to build HDF4, while newer ones (pgfortran) had no trouble. I submitted PR #493 to solve this issue. Now, if your compilers.yaml contains something like:HDF4 will build for you. However, when I run:
Spack still finds the older compilers first:
The PGI Installation Guide recommends using the newer compilers, although the older ones are kept around for backwards compatibility. Although I could simply remove
pgCC,pgf77, andpgf90from those lists, it would cause problems for anyone using older installations of PGI, which don't come with the newer compilers.I propose we change the way that
spack compiler addfinds compilers. My suggestion would be to choose the first match it finds incxx_names,f77_names, andf90_names. I believe the relevant code is in thefindmethod oflib/spack/spack/compiler.py. Things start to get complicated since we also need to be able to find compilers with prefixes, suffixes, or version numbers, and much of the code is parallelized for efficiency.If anyone would like to tackle this, and maybe wrap in a solution to any of the unresolved problems we've been seeing with Apple compilers, be my guest. Otherwise, I will hopefully get to it eventually. It doesn't significantly impact me since I can just
spack config edit compilersand switch it over to the newer ones, but it might trip up a new Spack user.