mirror of
				https://github.com/smyalygames/FiniteVolumeGPU.git
				synced 2025-10-31 20:17:41 +01:00 
			
		
		
		
	fix(gpu): correctly implement summing an array in HIPArkawaA2d
This commit is contained in:
		
							parent
							
								
									3fdd4ab62b
								
							
						
					
					
						commit
						7966ad0032
					
				| @ -12,15 +12,13 @@ def _sum_array(array: HIPArray2D): | ||||
|     Args: | ||||
|         array: A HIPArray2D to compute the sum of. | ||||
|     """ | ||||
|     data_h = array.data_h | ||||
|     num_bytes = array.num_bytes | ||||
| 
 | ||||
|     result_d = hip_check(hip.hipMalloc(num_bytes)) | ||||
|     result_h = np.zeros(1, dtype=array.dtype) | ||||
|     num_bytes = result_h.size * result_h.itemsize | ||||
|     result_d = hip_check(hip.hipMalloc(num_bytes)) | ||||
| 
 | ||||
|     # Sum the ``data_h`` array using hipblas | ||||
|     handle = hip_check(hipblas.hipblasCreate()) | ||||
|     hip_check(hipblas.hipblasSasum(handle, data_h.size, data_h.data, 1, result_d)) | ||||
|     hip_check(hipblas.hipblasSasum(handle, array.num_bytes, array.data, 1, result_d)) | ||||
|     hip_check(hipblas.hipblasDestroy(handle)) | ||||
| 
 | ||||
|     # Copy over the result from the device | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Anthony Berg
						Anthony Berg