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 = { | ||||
|             'gcc': [ | ||||
|                 '-O2', | ||||
|                 '-mtune=native', | ||||
|                 '-funroll-loops', | ||||
|                 '-ftree-vectorize', | ||||
|             ], | ||||
|   | ||||
| @@ -277,13 +277,10 @@ def cmake_args(self): | ||||
|         # https://groups.google.com/forum/?fromgroups#!topic/dealii/3Yjy8CBIrgU | ||||
|         if spec.satisfies('%gcc'): | ||||
|             cxx_flags_release.extend(['-O3']) | ||||
|             cxx_flags.extend(['-march=native']) | ||||
|         elif spec.satisfies('%intel'): | ||||
|             cxx_flags_release.extend(['-O3']) | ||||
|             cxx_flags.extend(['-march=native']) | ||||
|         elif spec.satisfies('%clang'): | ||||
|             cxx_flags_release.extend(['-O3', '-ffp-contract=fast']) | ||||
|             cxx_flags.extend(['-march=native']) | ||||
|  | ||||
|         # Python bindings | ||||
|         if spec.satisfies('@8.5.0:'): | ||||
|   | ||||
| @@ -84,8 +84,8 @@ def configure_args(self): | ||||
|         # adjust the C compiler or CFLAGS | ||||
|         if '+optflags' in self.spec: | ||||
|             options.extend([ | ||||
|                 'FCFLAGS=-O2 -march=native -ffree-line-length-none', | ||||
|                 'CFLAGS=-O2 -march=native' | ||||
|                 'FCFLAGS=-O2 -ffree-line-length-none', | ||||
|                 'CFLAGS=-O2' | ||||
|             ]) | ||||
|         if '+openmp' in self.spec: | ||||
|             options.append('--enable-openmp') | ||||
|   | ||||
| @@ -66,11 +66,6 @@ def configure_args(self): | ||||
|             cflags.append('-g') | ||||
|         elif any(map(self.spec.satisfies, ['%gcc', '%clang', '%intel'])): | ||||
|             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: | ||||
|             cflags.append('-O3') | ||||
|  | ||||
|   | ||||
| @@ -58,8 +58,6 @@ def cmake_args(self): | ||||
|             "-DAUTOCHECKOUT_MISSING_REPOS=OFF", | ||||
|             # | ||||
|             "-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 | ||||
|             "-DKRIMS_ENABLE_TESTS=OFF", | ||||
|             "-DKRIMS_ENABLE_EXAMPLES=" + str("+examples" in spec), | ||||
|   | ||||
| @@ -71,8 +71,6 @@ def cmake_args(self): | ||||
|             "-DAUTOCHECKOUT_MISSING_REPOS=OFF", | ||||
|             # | ||||
|             "-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 | ||||
|             "-DLAZYTEN_ENABLE_TESTS=OFF", | ||||
|             "-DLAZYTEN_ENABLE_EXAMPLES=" + str("+examples" in spec), | ||||
|   | ||||
| @@ -62,10 +62,6 @@ def common_make_opts(self): | ||||
|                 opt = '-g' | ||||
|             elif compiler.name == 'gcc': | ||||
|                 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): | ||||
|                     opt += ' -fopenmp-simd' | ||||
|             elif compiler.name == 'clang': | ||||
|   | ||||
| @@ -16,9 +16,7 @@ class Nanoflann(CMakePackage): | ||||
|     version('1.2.3', '92a0f44a631c41aa06f9716c51dcdb11') | ||||
|  | ||||
|     def patch(self): | ||||
|         if self.spec.target.family == 'aarch64' and \ | ||||
|                 self.spec.satisfies('%gcc@:5.9'): | ||||
|             filter_file('-mtune=native', '', 'CMakeLists.txt') | ||||
|         filter_file('-mtune=native', '', 'CMakeLists.txt') | ||||
|  | ||||
|     def cmake_args(self): | ||||
|         args = ['-DBUILD_SHARED_LIBS=ON'] | ||||
|   | ||||
| @@ -35,12 +35,10 @@ class Rocksdb(MakefilePackage): | ||||
|     phases = ['install'] | ||||
|  | ||||
|     def patch(self): | ||||
|         if (self.spec.target.family == 'aarch64' and | ||||
|             self.spec.satisfies('%gcc@:5.9')): | ||||
|             filter_file( | ||||
|                 '-march=native', '', | ||||
|                 join_path('build_tools', 'build_detect_platform') | ||||
|             ) | ||||
|         filter_file( | ||||
|             '-march=native', '', | ||||
|             join_path('build_tools', 'build_detect_platform') | ||||
|         ) | ||||
|  | ||||
|     def install(self, spec, prefix): | ||||
|         cflags = [] | ||||
|   | ||||
| @@ -25,10 +25,7 @@ class Tealeaf(MakefilePackage): | ||||
|     depends_on('mpi') | ||||
|  | ||||
|     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 | ||||
|     def build_targets(self): | ||||
|   | ||||
| @@ -65,13 +65,10 @@ def configure_args(self): | ||||
|         # https://src.fedoraproject.org/cgit/rpms/elpa.git/ | ||||
|         # https://packages.qa.debian.org/e/elpa.html | ||||
|         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: | ||||
|             options.extend([ | ||||
|                 'FCFLAGS=-O2 -march=native -ffree-line-length-none', | ||||
|                 'CFLAGS=-O2 -march=native' | ||||
|                 'FCFLAGS=-O2 -ffree-line-length-none', | ||||
|                 'CFLAGS=-O2' | ||||
|             ]) | ||||
|         if '+openmp' in self.spec: | ||||
|             options.append('--enable-openmp') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user