From 8619e5b5ab9e00b05de99521c3b57c3620dcf074 Mon Sep 17 00:00:00 2001 From: "Nichols A. Romero" Date: Sat, 17 Oct 2020 15:27:09 -0500 Subject: [PATCH] Removing classic flang. (#19350) --- .../repos/builtin/packages/flang/package.py | 126 -------- .../builtin/packages/llvm-flang/package.py | 268 ------------------ .../packages/pgmath/libpgmath_symbols.patch | 91 ------ .../repos/builtin/packages/pgmath/package.py | 38 --- 4 files changed, 523 deletions(-) delete mode 100644 var/spack/repos/builtin/packages/flang/package.py delete mode 100644 var/spack/repos/builtin/packages/llvm-flang/package.py delete mode 100644 var/spack/repos/builtin/packages/pgmath/libpgmath_symbols.patch delete mode 100644 var/spack/repos/builtin/packages/pgmath/package.py diff --git a/var/spack/repos/builtin/packages/flang/package.py b/var/spack/repos/builtin/packages/flang/package.py deleted file mode 100644 index aa45185d6c..0000000000 --- a/var/spack/repos/builtin/packages/flang/package.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -from spack import * -import os - - -class Flang(CMakePackage): - """Flang is a Fortran compiler targeting LLVM.""" - - homepage = "https://github.com/flang-compiler/flang" - - url = "https://github.com/flang-compiler/flang/archive/flang_20190329.tar.gz" - git = "https://github.com/flang-compiler/flang.git" - - maintainers = ['naromero77'] - - version('master', branch='master', preferred=True) - version('20190329', sha256='b8c621da53829f8c53bad73125556fb1839c9056d713433b05741f7e445199f2') - version('20181226', sha256='00e716bea258c3bb60d6a5bb0c82bc79f67000062dc89939693e75f501883c36') - version('20180921', sha256='f33bd1f054e474f1e8a204bb6f78d42f8f6ecf7a894fdddc3999f7c272350784') - version('20180612', sha256='6af858bea013548e091371a97726ac784edbd4ff876222575eaae48a3c2920ed') - - # variants - msg = ('Target OpenMP offloading to NVIDIA GPUs ' - '(experimental w/ no support). ' - 'Only works with GCC compilers compatible with CUDA 9.x. ' - 'Specify ^llvm-flang+cuda cuda_arch= explictly.') - - variant('nvptx', - default=False, - description=msg) - - # Patched only relevant for March 2019 release with OpenMP Offload support - patch('https://github.com/flang-compiler/flang/commit/b342225a64692d2b9c3aff7658a8e4f94a8923eb.diff', - sha256='3bd2c7453131eaaf11328785a3031fa2298bdd0c02cfd5e2b478e6e847d5da43', - when='@20190329 +nvptx') - - # Build dependency - depends_on('cmake@3.8:', type='build') - depends_on('python@2.7:', type='build') - - depends_on('llvm-flang@release_90', when='@master ~nvptx') - depends_on('llvm-flang@20190329', when='@20190329 ~nvptx') - depends_on('llvm-flang@20181226_70', when='@20181226') - depends_on('llvm-flang@20180921', when='@20180921') - depends_on('llvm-flang@20180612', when='@20180612') - - depends_on('pgmath@master', when='@master') - depends_on('pgmath@20190329', when='@20190329') - depends_on('pgmath@20181226', when='@20181226') - depends_on('pgmath@20180921', when='@20180921') - depends_on('pgmath@20180612', when='@20180612') - - depends_on('llvm-flang+cuda@release_70', when='@master +nvptx') - depends_on('llvm-flang+cuda@20190329', when='@20190329 +nvptx') - - # conflicts - conflicts('+nvptx', when='@:20181226', - msg='OpenMP offload to NVidia GPUs available 20190329 or later') - - # Spurious problems running in parallel the Makefile - # generated by the configure - parallel = False - - def cmake_args(self): - spec = self.spec - options = [ - '-DWITH_WERROR=OFF', - '-DCMAKE_C_COMPILER=%s' % os.path.join( - spec['llvm-flang'].prefix.bin, 'clang'), - '-DCMAKE_CXX_COMPILER=%s' % os.path.join( - spec['llvm-flang'].prefix.bin, 'clang++'), - '-DCMAKE_Fortran_COMPILER=%s' % os.path.join( - spec['llvm-flang'].prefix.bin, 'flang'), - '-DFLANG_LIBOMP=%s' % find_libraries( - 'libomp', root=spec['llvm-flang'].prefix.lib), - '-DPYTHON_EXECUTABLE={0}'.format( - spec['python'].command.path) - ] - - # Make sure llvm-flang can find GCC's libstdc++ - if self.compiler.name == "gcc": - gcc_prefix = ancestor(self.compiler.cc, 2) - options.append('-DGCC_INSTALL_PREFIX=' + gcc_prefix) - - if '+cuda' in spec: - options.append('-DFLANG_OPENMP_GPU_NVIDIA=ON') - else: - options.append('-DFLANG_OPENMP_GPU_NVIDIA=OFF') - - return options - - @run_after('install') - def post_install(self): - # we are installing flang in a path different from llvm, so we - # create a wrapper with -L for e.g. libflangrti.so and -I for - # e.g. iso_c_binding.mod. -B is needed to help flang to find - # flang1 and flang2. rpath_arg is needed so that executables - # generated by flang can find libflang later. - flang = os.path.join(self.spec.prefix.bin, 'flang') - with open(flang, 'w') as out: - out.write('#!/bin/bash\n') - out.write( - '{0} -I{1} -L{2} -L{3} {4}{5} {6}{7} -B{8} "$@"\n'.format( - self.spec['llvm-flang'].prefix.bin.flang, - self.prefix.include, self.prefix.lib, - self.spec['pgmath'].prefix.lib, - self.compiler.fc_rpath_arg, self.prefix.lib, - self.compiler.fc_rpath_arg, - self.spec['pgmath'].prefix.lib, self.spec.prefix.bin)) - out.close() - chmod = which('chmod') - chmod('+x', flang) - - def setup_build_environment(self, env): - # to find llvm's libc++.so - env.set('LD_LIBRARY_PATH', self.spec['llvm-flang'].prefix.lib) - - def setup_run_environment(self, env): - env.set('FC', self.spec.prefix.bin.flang) - env.set('F77', self.spec.prefix.bin.flang) - env.set('F90', self.spec.prefix.bin.flang) diff --git a/var/spack/repos/builtin/packages/llvm-flang/package.py b/var/spack/repos/builtin/packages/llvm-flang/package.py deleted file mode 100644 index 4b9358ce06..0000000000 --- a/var/spack/repos/builtin/packages/llvm-flang/package.py +++ /dev/null @@ -1,268 +0,0 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -from spack import * - - -class LlvmFlang(CMakePackage, CudaPackage): - """LLVM-Flang is the Flang fork of LLVM needed by the Flang package.""" - - homepage = "https://github.com/flang-compiler" - - git = "https://github.com/flang-compiler/llvm.git" - - maintainer = ['naromero77'] - - version('release_90', branch='release_90', preferred=True) - version('release_80', branch='release_80') - version('release_70', branch='release_70') - version('release_60', branch='release_60') - version('20190329', tag='flang_20190329') - version('20181226_70', tag='20181226_70') - version('20181226_60', tag='20181226_60') - version('20180921', tag='20180921') - version('20180319', tag='20180319') - version('20180328', tag='20180308') - - # Variants - variant('all_targets', default=False, - description='Build all supported targets') - - variant('build_type', default='Release', - description='The CMake build type to build', - values=('Debug', 'Release', 'RelWithDebInfo', 'MinSizeRel')) - - # Universal dependency - depends_on('cmake@3.8:', type='build') - depends_on('python@2.7:', type='build') - - # openmp dependencies - depends_on('perl-data-dumper', type=('build')) - depends_on('hwloc') - - # libomptarget dependencies - depends_on('libelf', when='+cuda') - depends_on('libffi', when='+cuda') - # note that there may be other llvm-flang + cuda conflicts, but these - # are the only versions that are relevant for the flang+nvptx package - # llvm 7 not compatible with newer version of cuda - depends_on('cuda@:9', when='+cuda@release_70') - depends_on('cuda@:9', when='+cuda@20190329') - - # LLVM-Flang Componentes: Driver, OpenMP - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - branch='release_90', - destination='tools', - placement='clang', - when='@release_90') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - branch='release_80', - destination='tools', - placement='clang', - when='@release_80') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - branch='release_70', - destination='tools', - placement='clang', - when='@release_70') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - branch='release_60', - destination='tools', - placement='clang', - when='@release_60') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - tag='flang_20190329', - destination='tools', - placement='clang', - when='@20190329') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - tag='flang_20181226_70', - destination='tools', - placement='clang', - when='@20181226_70') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - tag='flang_20181226_60', - destination='tools', - placement='clang', - when='@20181226_60') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - tag='flang_20180921', - destination='tools', - placement='clang', - when='@20180921') - - resource(name='flang-driver', - git='https://github.com/flang-compiler/flang-driver.git', - tag='flang_20180921', - destination='tools', - placement='clang', - when='@20180308') - - resource(name='openmp', - git='https://github.com/llvm-mirror/openmp.git', - branch='release_90', - destination='projects', - placement='openmp', - when='@release_90') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - branch='release_80', - destination='projects', - placement='openmp', - when='@release_80') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - branch='release_70', - destination='projects', - placement='openmp', - when='@release_70') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - branch='release_60', - destination='projects', - placement='openmp', - when='@release_60') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - tag='flang_20190329', - destination='projects', - placement='openmp', - when='@20190329') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - tag='flang_20181226_70', - destination='projects', - placement='openmp', - when='@20181226_70') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - tag='flang_20181226_60', - destination='projects', - placement='openmp', - when='@20181226_60') - - resource(name='openmp', - git='https://github.com/flang-compiler/openmp.git', - tag='flang_20180921', - destination='projects', - placement='openmp', - when='@20180921') - - def cmake_args(self): - spec = self.spec - # universal - args = [ - '-DLLVM_ENABLE_RTTI:BOOL=ON', - '-DLLVM_ENABLE_EH:BOOL=ON', - '-DCLANG_DEFAULT_OPENMP_RUNTIME:STRING=libomp', - ] - args.append('-DPYTHON_EXECUTABLE={0}'.format( - spec['python'].command.path)) - - # needed by flang-driver - args.append('-DFLANG_LLVM_EXTENSIONS=ON') - - if '+all_targets' not in spec: # all is default in cmake - if spec.target.family == 'x86' or spec.target.family == 'x86_64': - target = 'X86' - elif spec.target.family == 'arm': - target = 'ARM' - elif spec.target.family == 'aarch64': - target = 'AArch64' - elif (spec.target.family == 'ppc64' or - spec.target.family == 'ppc64le' or - spec.target.family == 'ppc' or - spec.target.family == 'ppcle'): - target = 'PowerPC' - else: - raise InstallError( - 'Unsupported architecture: ' + spec.target.family) - - if '+cuda' in spec: - args.append( - '-DLLVM_TARGETS_TO_BUILD:STRING=NVPTX;' + target) - else: - args.append( - '-DLLVM_TARGETS_TO_BUILD:STRING=' + target) - - # used by openmp - args.append('-DLIBOMP_USE_HWLOC=On') - args.append('-DLIBOMP_FORTRAN_MODULES=ON') - args.append('-DLIBOMP_ENABLE_SHARED=TRUE') - - # Make sure llvm-flang can find GCC's libstdc++ - if self.compiler.name == "gcc": - gcc_prefix = ancestor(self.compiler.cc, 2) - args.append('-DGCC_INSTALL_PREFIX=' + gcc_prefix) - - # used by libomptarget for NVidia gpu - if '+cuda' in spec: - args.append('-DOPENMP_ENABLE_LIBOMPTARGET=ON') - cuda_arch_list = spec.variants['cuda_arch'].value - args.append('-DCUDA_TOOLKIT_ROOT_DIR=%s' % spec['cuda'].prefix) - args.append('-DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES={0}'.format( - ','.join(cuda_arch_list))) - args.append('-DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_{0}'.format( - cuda_arch_list[-1])) - else: - args.append('-DOPENMP_ENABLE_LIBOMPTARGET=OFF') - - return args - - @run_after("install") - def post_install(self): - spec = self.spec - - # Manual bootstrap needed to get NVidia BC compiled with the - # clang that was just built - if '+cuda' in spec: - ompdir = 'build-bootstrapped-omp' - # rebuild libomptarget to get bytecode runtime library files - with working_dir(ompdir, create=True): - args = [ - self.stage.source_path + '/projects/openmp', - '-DCMAKE_C_COMPILER:PATH={0}'.format( - spec.prefix.bin + '/clang'), - '-DCMAKE_CXX_COMPILER:PATH={0}'.format( - spec.prefix.bin + '/clang++'), - '-DCMAKE_INSTALL_PREFIX:PATH={0}'.format( - spec.prefix) - ] - args = args + self.cmake_args() - # args = self.cmake_args() - # enable CUDA bitcode - args.append('-DLIBOMPTARGET_NVPTX_ENABLE_BCLIB=true') - # work around bad libelf detection in libomptarget - args.append( - '-DCMAKE_CXX_FLAGS:String=-I{0} -I{1}'.format( - spec['libelf'].prefix.include, - spec['hwloc'].prefix.include)) - - # Only build if offload target. - cmake(*args) - make() - make('install') diff --git a/var/spack/repos/builtin/packages/pgmath/libpgmath_symbols.patch b/var/spack/repos/builtin/packages/pgmath/libpgmath_symbols.patch deleted file mode 100644 index 65b7d40bea..0000000000 --- a/var/spack/repos/builtin/packages/pgmath/libpgmath_symbols.patch +++ /dev/null @@ -1,91 +0,0 @@ -diff --git a/runtime/libpgmath/lib/common/ceil.c b/runtime/libpgmath/lib/common/ceil.c -index 3b66ca5c..341c5194 100644 ---- a/runtime/libpgmath/lib/common/ceil.c -+++ b/runtime/libpgmath/lib/common/ceil.c -@@ -16,9 +16,11 @@ - */ - - #include "mthdecls.h" -+/* - #if defined(__SSE4_1__) || defined(__AVX__) - #include - #endif -+*/ - - float - __mth_i_ceil(float x) -diff --git a/runtime/libpgmath/lib/common/dceil.c b/runtime/libpgmath/lib/common/dceil.c -index 67482ef2..5dae82f9 100644 ---- a/runtime/libpgmath/lib/common/dceil.c -+++ b/runtime/libpgmath/lib/common/dceil.c -@@ -16,6 +16,7 @@ - */ - - #include "mthdecls.h" -+/* - #if defined(__SSE4_1__) || defined(__AVX__) - #include - #endif -@@ -33,9 +34,12 @@ __mth_i_dceil_sse(double x) - return _mm_cvtsd_f64(_mm_ceil_sd(_mm_set1_pd(x), _mm_set1_pd(x))); - } - #else -+*/ - double - __mth_i_dceil(double x) - { - return ceil(x); - } -+/* - #endif -+*/ -diff --git a/runtime/libpgmath/lib/common/dfloor.c b/runtime/libpgmath/lib/common/dfloor.c -index f947ef33..8b955897 100644 ---- a/runtime/libpgmath/lib/common/dfloor.c -+++ b/runtime/libpgmath/lib/common/dfloor.c -@@ -16,6 +16,7 @@ - */ - - #include "mthdecls.h" -+/* - #if defined(__SSE4_1__) || defined(__AVX__) - #include - #endif -@@ -33,9 +34,12 @@ __mth_i_dfloor_sse(double x) - return _mm_cvtsd_f64(_mm_floor_sd(_mm_set1_pd(x), _mm_set1_pd(x))); - } - #else -+*/ - double - __mth_i_dfloor(double x) - { - return floor(x); - } -+/* - #endif -+*/ -diff --git a/runtime/libpgmath/lib/common/floor.c b/runtime/libpgmath/lib/common/floor.c -index 7865bedc..c13872df 100644 ---- a/runtime/libpgmath/lib/common/floor.c -+++ b/runtime/libpgmath/lib/common/floor.c -@@ -16,6 +16,7 @@ - */ - - #include "mthdecls.h" -+/* - #if defined(__SSE4_1__) || defined(__AVX__) - #include - #endif -@@ -33,9 +34,12 @@ __mth_i_floor_sse(float x) - return _mm_cvtss_f32(_mm_floor_ss(_mm_set1_ps(x), _mm_set1_ps(x))); - } - #else -+*/ - float - __mth_i_floor(float x) - { - return floorf(x); - } -+/* - #endif -+*/ diff --git a/var/spack/repos/builtin/packages/pgmath/package.py b/var/spack/repos/builtin/packages/pgmath/package.py deleted file mode 100644 index bd08ba8b40..0000000000 --- a/var/spack/repos/builtin/packages/pgmath/package.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -from spack import * - - -class Pgmath(CMakePackage): - """Flang's math library""" - - homepage = "https://github.com/flang-compiler/flang" - url = "https://github.com/flang-compiler/flang/archive/flang_20190329.tar.gz" - git = "https://github.com/flang-compiler/flang.git" - - maintainers = ['naromero77'] - - version('master', branch='master') - version('20190329', sha256='b8c621da53829f8c53bad73125556fb1839c9056d713433b05741f7e445199f2') - version('20181226', sha256='00e716bea258c3bb60d6a5bb0c82bc79f67000062dc89939693e75f501883c36') - version('20180921', sha256='f33bd1f054e474f1e8a204bb6f78d42f8f6ecf7a894fdddc3999f7c272350784') - version('20180612', sha256='6af858bea013548e091371a97726ac784edbd4ff876222575eaae48a3c2920ed') - - # work around for this issue - # https://github.com/flang-compiler/flang/issues/602 - patch('https://github.com/flang-compiler/flang/commit/7fcd6346a9427977afe4534c0f19bbbba04c99a3.diff', - sha256='4014df1e5855dd21242b0fc938a4e7835941c20f9a89c3a7a5314e74b6232bcb', - when='@20190329') - - # workaround for this issue - # https://github.com/flang-compiler/flang/issues/838 - patch('libpgmath_symbols.patch', when='@20190329,master') - - depends_on("awk", type="build") - conflicts("%gcc@:7.1.9999") - - root_cmakelists_dir = 'runtime/libpgmath'