Fix build_jobs exceeding number of cores
All documentation mentions that `build_jobs` is limited by the number of cores available in the system. This is also enforced when setting it via `--jobs`. However, when setting it via `config.yaml`, it can exceed the number of cores available, making builds run out of memory.
This commit is contained in:
		 Michael Kuhn
					Michael Kuhn
				
			
				
					committed by
					
						 Peter Scheibel
						Peter Scheibel
					
				
			
			
				
	
			
			
			 Peter Scheibel
						Peter Scheibel
					
				
			
						parent
						
							3f83a2a7d8
						
					
				
				
					commit
					a7e915d38b
				
			| @@ -406,6 +406,7 @@ def _set_variables_for_single_module(pkg, module): | |||||||
|     """Helper function to set module variables for single module.""" |     """Helper function to set module variables for single module.""" | ||||||
|  |  | ||||||
|     jobs = spack.config.get('config:build_jobs') if pkg.parallel else 1 |     jobs = spack.config.get('config:build_jobs') if pkg.parallel else 1 | ||||||
|  |     jobs = min(jobs, multiprocessing.cpu_count()) | ||||||
|     assert jobs is not None, "no default set for config:build_jobs" |     assert jobs is not None, "no default set for config:build_jobs" | ||||||
|  |  | ||||||
|     m = module |     m = module | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user