mirror of
				https://github.com/smyalygames/FiniteVolumeGPU.git
				synced 2025-10-31 20:27:40 +01:00 
			
		
		
		
	feat(gpu): add common cache directory
This commit is contained in:
		
							parent
							
								
									4df7b9b6b7
								
							
						
					
					
						commit
						3aedef93cf
					
				
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,3 +1,6 @@ | ||||
| # Cache directory for kernels from this repository | ||||
| /.fvm_cache | ||||
| 
 | ||||
| .vscode/settings.json | ||||
| 
 | ||||
| /data | ||||
|  | ||||
| @ -76,6 +76,7 @@ class HIPArray2D(BaseArray2D): | ||||
| 
 | ||||
|         self.check(x, y, nx, ny, cpu_data) | ||||
| 
 | ||||
|         # TODO implement non-async to test if it actually works - avoid errors | ||||
|         # Create a copy object from device to host | ||||
|         hip_check(hip.hipMemcpyAsync(self.data_d, self.data_h, self.num_bytes, hip.hipMemcpyKind.hipMemcpyHostToDevice, | ||||
|                                      stream)) | ||||
|  | ||||
| @ -5,6 +5,8 @@ import re | ||||
| import logging | ||||
| from hashlib import md5 | ||||
| 
 | ||||
| from GPUSimulators.common.utils import get_project_root | ||||
| 
 | ||||
| 
 | ||||
| class Context(object): | ||||
|     """ | ||||
| @ -24,10 +26,10 @@ class Context(object): | ||||
|         self.autotuner = None | ||||
| 
 | ||||
|         # Creates cache directory if specified | ||||
|         self.cache_path = os.path.join(self.module_path, f"{language}_cache") | ||||
|         self.cache_path = os.path.join(get_project_root(), ".fvm_cache", type(self).__name__.lower()) | ||||
|         if self.use_cache: | ||||
|             if not os.path.isdir(self.cache_path): | ||||
|                 os.mkdir(self.cache_path) | ||||
|                 os.makedirs(self.cache_path) | ||||
|             self.logger.info(f"Using cache dir {self.cache_path}") | ||||
| 
 | ||||
|     def __del__(self): | ||||
| @ -81,7 +83,7 @@ class Context(object): | ||||
|                 kernel_hasher.update(str(modified).encode('utf-8')) | ||||
| 
 | ||||
|                 # Find all the includes | ||||
|                 includes = re.findall('^\W*#include\W+(.+?)\W*$', file_str, re.M) | ||||
|                 includes = re.findall('^\\W*#include\\W+(.+?)\\W*$', file_str, re.M) | ||||
| 
 | ||||
|             # Iterate through everything that looks like is an ``include`` | ||||
|             for include_file in includes: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Anthony Berg
						Anthony Berg