Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ByMusti
- __device__ int global_thread_idx_x()
- {
- return blockIdx.x*blockDim.x + threadIdx.x;
- }
- int ceil_div(int const numerator, int const denominator)
- {
- auto res = std::div(numerator, denominator);
- return res.rem ? (res.quot + 1) : res.quot;
- }
- __host__ __device__ __forceinline__
- float norm(float3 const & p, float3 const & q) {
- float xDist = ((p.x - q.x)*(p.x - q.x));
- float yDist = ((p.y - q.y)*(p.y - q.y));
- float zDist = ((p.z - q.z)*(p.z - q.z));
- return (xDist + yDist + zDist); // wir verzichten auf sqrt, da es für uns irrelevant ist
- }
- __host__ __device__ __forceinline__
- dim3 blocksPerGrid(dim3 const & block, int3 const & size)
- {
- return dim3(ceil_div(size.x, block.x), 1, 1);
- }
Advertisement
Add Comment
Please, Sign In to add comment