Removed references to '(-march|-mtune|-mcpu)=native' (#12948)
Now that Spack injects microarchitecture specific optimizations for the selected target, packages should avoid adding flags that could step over those.
This commit is contained in:
		 Massimiliano Culpo
					Massimiliano Culpo
				
			
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			 GitHub
						GitHub
					
				
			
						parent
						
							78d051b534
						
					
				
				
					commit
					31e5318c24
				
			| @@ -160,7 +160,6 @@ def edit(self, spec, prefix): | |||||||
|         optimization_flags = { |         optimization_flags = { | ||||||
|             'gcc': [ |             'gcc': [ | ||||||
|                 '-O2', |                 '-O2', | ||||||
|                 '-mtune=native', |  | ||||||
|                 '-funroll-loops', |                 '-funroll-loops', | ||||||
|                 '-ftree-vectorize', |                 '-ftree-vectorize', | ||||||
|             ], |             ], | ||||||
|   | |||||||
| @@ -277,13 +277,10 @@ def cmake_args(self): | |||||||
|         # https://groups.google.com/forum/?fromgroups#!topic/dealii/3Yjy8CBIrgU |         # https://groups.google.com/forum/?fromgroups#!topic/dealii/3Yjy8CBIrgU | ||||||
|         if spec.satisfies('%gcc'): |         if spec.satisfies('%gcc'): | ||||||
|             cxx_flags_release.extend(['-O3']) |             cxx_flags_release.extend(['-O3']) | ||||||
|             cxx_flags.extend(['-march=native']) |  | ||||||
|         elif spec.satisfies('%intel'): |         elif spec.satisfies('%intel'): | ||||||
|             cxx_flags_release.extend(['-O3']) |             cxx_flags_release.extend(['-O3']) | ||||||
|             cxx_flags.extend(['-march=native']) |  | ||||||
|         elif spec.satisfies('%clang'): |         elif spec.satisfies('%clang'): | ||||||
|             cxx_flags_release.extend(['-O3', '-ffp-contract=fast']) |             cxx_flags_release.extend(['-O3', '-ffp-contract=fast']) | ||||||
|             cxx_flags.extend(['-march=native']) |  | ||||||
|  |  | ||||||
|         # Python bindings |         # Python bindings | ||||||
|         if spec.satisfies('@8.5.0:'): |         if spec.satisfies('@8.5.0:'): | ||||||
|   | |||||||
| @@ -84,8 +84,8 @@ def configure_args(self): | |||||||
|         # adjust the C compiler or CFLAGS |         # adjust the C compiler or CFLAGS | ||||||
|         if '+optflags' in self.spec: |         if '+optflags' in self.spec: | ||||||
|             options.extend([ |             options.extend([ | ||||||
|                 'FCFLAGS=-O2 -march=native -ffree-line-length-none', |                 'FCFLAGS=-O2 -ffree-line-length-none', | ||||||
|                 'CFLAGS=-O2 -march=native' |                 'CFLAGS=-O2' | ||||||
|             ]) |             ]) | ||||||
|         if '+openmp' in self.spec: |         if '+openmp' in self.spec: | ||||||
|             options.append('--enable-openmp') |             options.append('--enable-openmp') | ||||||
|   | |||||||
| @@ -66,11 +66,6 @@ def configure_args(self): | |||||||
|             cflags.append('-g') |             cflags.append('-g') | ||||||
|         elif any(map(self.spec.satisfies, ['%gcc', '%clang', '%intel'])): |         elif any(map(self.spec.satisfies, ['%gcc', '%clang', '%intel'])): | ||||||
|             cflags.append('-O3') |             cflags.append('-O3') | ||||||
|             if self.compiler.target in ['x86_64']: |  | ||||||
|                 cflags.append('-march=native') |  | ||||||
|             elif not self.spec.satisfies('target=aarch64: %gcc@:5.9'): |  | ||||||
|                 cflags.append('-mcpu=native') |  | ||||||
|                 cflags.append('-mtune=native') |  | ||||||
|         else: |         else: | ||||||
|             cflags.append('-O3') |             cflags.append('-O3') | ||||||
|  |  | ||||||
|   | |||||||
| @@ -58,8 +58,6 @@ def cmake_args(self): | |||||||
|             "-DAUTOCHECKOUT_MISSING_REPOS=OFF", |             "-DAUTOCHECKOUT_MISSING_REPOS=OFF", | ||||||
|             # |             # | ||||||
|             "-DBUILD_SHARED_LIBS=" + str("+shared" in spec), |             "-DBUILD_SHARED_LIBS=" + str("+shared" in spec), | ||||||
|             "-DDRB_MACHINE_SPECIFIC_OPTIM_Release=ON",  # Adds -march=native |  | ||||||
|             # |  | ||||||
|             # TODO Hard-disable tests for now, since rapidcheck not in Spack |             # TODO Hard-disable tests for now, since rapidcheck not in Spack | ||||||
|             "-DKRIMS_ENABLE_TESTS=OFF", |             "-DKRIMS_ENABLE_TESTS=OFF", | ||||||
|             "-DKRIMS_ENABLE_EXAMPLES=" + str("+examples" in spec), |             "-DKRIMS_ENABLE_EXAMPLES=" + str("+examples" in spec), | ||||||
|   | |||||||
| @@ -71,8 +71,6 @@ def cmake_args(self): | |||||||
|             "-DAUTOCHECKOUT_MISSING_REPOS=OFF", |             "-DAUTOCHECKOUT_MISSING_REPOS=OFF", | ||||||
|             # |             # | ||||||
|             "-DBUILD_SHARED_LIBS=" + str("+shared" in spec), |             "-DBUILD_SHARED_LIBS=" + str("+shared" in spec), | ||||||
|             "-DDRB_MACHINE_SPECIFIC_OPTIM_Release=ON",  # Adds -march=native |  | ||||||
|             # |  | ||||||
|             # TODO Hard-disable tests for now, since rapidcheck not in Spack |             # TODO Hard-disable tests for now, since rapidcheck not in Spack | ||||||
|             "-DLAZYTEN_ENABLE_TESTS=OFF", |             "-DLAZYTEN_ENABLE_TESTS=OFF", | ||||||
|             "-DLAZYTEN_ENABLE_EXAMPLES=" + str("+examples" in spec), |             "-DLAZYTEN_ENABLE_EXAMPLES=" + str("+examples" in spec), | ||||||
|   | |||||||
| @@ -62,10 +62,6 @@ def common_make_opts(self): | |||||||
|                 opt = '-g' |                 opt = '-g' | ||||||
|             elif compiler.name == 'gcc': |             elif compiler.name == 'gcc': | ||||||
|                 opt = '-O3 -g -ffp-contract=fast' |                 opt = '-O3 -g -ffp-contract=fast' | ||||||
|                 if compiler.target in ['x86_64']: |  | ||||||
|                     opt += ' -march=native' |  | ||||||
|                 elif compiler.target in ['ppc64le']: |  | ||||||
|                     opt += ' -mcpu=native -mtune=native' |  | ||||||
|                 if compiler.version >= ver(4.9): |                 if compiler.version >= ver(4.9): | ||||||
|                     opt += ' -fopenmp-simd' |                     opt += ' -fopenmp-simd' | ||||||
|             elif compiler.name == 'clang': |             elif compiler.name == 'clang': | ||||||
|   | |||||||
| @@ -16,9 +16,7 @@ class Nanoflann(CMakePackage): | |||||||
|     version('1.2.3', '92a0f44a631c41aa06f9716c51dcdb11') |     version('1.2.3', '92a0f44a631c41aa06f9716c51dcdb11') | ||||||
|  |  | ||||||
|     def patch(self): |     def patch(self): | ||||||
|         if self.spec.target.family == 'aarch64' and \ |         filter_file('-mtune=native', '', 'CMakeLists.txt') | ||||||
|                 self.spec.satisfies('%gcc@:5.9'): |  | ||||||
|             filter_file('-mtune=native', '', 'CMakeLists.txt') |  | ||||||
|  |  | ||||||
|     def cmake_args(self): |     def cmake_args(self): | ||||||
|         args = ['-DBUILD_SHARED_LIBS=ON'] |         args = ['-DBUILD_SHARED_LIBS=ON'] | ||||||
|   | |||||||
| @@ -35,12 +35,10 @@ class Rocksdb(MakefilePackage): | |||||||
|     phases = ['install'] |     phases = ['install'] | ||||||
|  |  | ||||||
|     def patch(self): |     def patch(self): | ||||||
|         if (self.spec.target.family == 'aarch64' and |         filter_file( | ||||||
|             self.spec.satisfies('%gcc@:5.9')): |             '-march=native', '', | ||||||
|             filter_file( |             join_path('build_tools', 'build_detect_platform') | ||||||
|                 '-march=native', '', |         ) | ||||||
|                 join_path('build_tools', 'build_detect_platform') |  | ||||||
|             ) |  | ||||||
|  |  | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         cflags = [] |         cflags = [] | ||||||
|   | |||||||
| @@ -25,10 +25,7 @@ class Tealeaf(MakefilePackage): | |||||||
|     depends_on('mpi') |     depends_on('mpi') | ||||||
|  |  | ||||||
|     def edit(self, spec, prefix): |     def edit(self, spec, prefix): | ||||||
|         if spec.target.family == 'aarch64' and spec.satisfies('%gcc@:5.9'): |         filter_file('-march=native', '', join_path('TeaLeaf_ref', 'Makefile')) | ||||||
|             filter_file( |  | ||||||
|                 '-march=native', '', join_path('TeaLeaf_ref', 'Makefile') |  | ||||||
|             ) |  | ||||||
|  |  | ||||||
|     @property |     @property | ||||||
|     def build_targets(self): |     def build_targets(self): | ||||||
|   | |||||||
| @@ -65,13 +65,10 @@ def configure_args(self): | |||||||
|         # https://src.fedoraproject.org/cgit/rpms/elpa.git/ |         # https://src.fedoraproject.org/cgit/rpms/elpa.git/ | ||||||
|         # https://packages.qa.debian.org/e/elpa.html |         # https://packages.qa.debian.org/e/elpa.html | ||||||
|         options = [] |         options = [] | ||||||
|         # without -march=native there is configure error for 2017.05.02 |  | ||||||
|         # Could not compile test program, try with --disable-sse, or |  | ||||||
|         # adjust the C compiler or CFLAGS |  | ||||||
|         if '+optflags' in self.spec: |         if '+optflags' in self.spec: | ||||||
|             options.extend([ |             options.extend([ | ||||||
|                 'FCFLAGS=-O2 -march=native -ffree-line-length-none', |                 'FCFLAGS=-O2 -ffree-line-length-none', | ||||||
|                 'CFLAGS=-O2 -march=native' |                 'CFLAGS=-O2' | ||||||
|             ]) |             ]) | ||||||
|         if '+openmp' in self.spec: |         if '+openmp' in self.spec: | ||||||
|             options.append('--enable-openmp') |             options.append('--enable-openmp') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user