#include "hip/hip_runtime.h" #include "hip/hip_runtime.h" #include "hip/hip_runtime.h" #include "cuda_commen.h" #include "cuda_utility.h" #include "parameters.h" #include "parameters_d.h" #ifdef __cplusplus extern "C"{ #endif __global__ void cuda_mem_value_init(REAL value, REAL *ptr, unsigned int pitch, unsigned int size_x, unsigned int size_y, unsigned int size_z) { unsigned int x = blockIdx.x * blockDim.x + threadIdx.x; unsigned int y = blockIdx.y * blockDim.y + threadIdx.y; unsigned int z = blockIdx.z * blockDim.z + threadIdx.z; if (x < size_x && y < size_y && z < size_z) { *(ptr + x + pitch * (y + z * size_y)) = value; } } void cuda_mem_value_init_warp(REAL value, REAL *ptr, unsigned int pitch, unsigned int size_x, unsigned int size_y, unsigned int size_z){ dim3 griddim ; dim3 blockdim ; cal_grid_block_dim(&griddim , &blockdim , BlockDimX , BlockDimY , BlockDimZ , size_x , size_y , size_z); hipLaunchKernelGGL(cuda_mem_value_init, dim3(griddim ), dim3(blockdim), 0, 0, value, ptr , pitch , size_x , size_y , size_z); } /* ========================= */ __global__ void pri_to_cons_kernel(cudaSoA pcons , cudaField pd , cudaField pu , cudaField pv , cudaField pw , cudaField pT ,cudaJobPackage job ){ // eyes on cells WITHOUT LAPs unsigned int x = blockIdx.x * blockDim.x + threadIdx.x + job.start.x; unsigned int y = blockIdx.y * blockDim.y + threadIdx.y + job.start.y; unsigned int z = blockIdx.z * blockDim.z + threadIdx.z + job.start.z; REAL d,u,v,w,T; if(x