41 lines
1.4 KiB
Plaintext
Executable File
41 lines
1.4 KiB
Plaintext
Executable File
#ifndef HEADER_CUH
|
|
#define HEADER_CUH
|
|
|
|
#include <iostream>
|
|
#include <cassert>
|
|
|
|
#include <cpp_progress.hpp>
|
|
|
|
using namespace std;
|
|
|
|
using base_t = uint64_t;
|
|
|
|
static const size_t base_len = sizeof(base_t) * 8;
|
|
|
|
static const base_t base_zero = (base_t)0x00'00'00'00'00'00'00'00;
|
|
static const base_t base_one = (base_t)0x00'00'00'00'00'00'00'01;
|
|
|
|
static const base_t base_fullmask = (base_t)0xFF'FF'FF'FF'FF'FF'FF'FF;
|
|
|
|
static const size_t THREAD_X = 16; // 列
|
|
static const size_t THREAD_Y = 16; // 行
|
|
|
|
template <typename T>
|
|
__host__ __device__ T *at_base(T *base, size_t rowstride, size_t r, size_t w)
|
|
{
|
|
return base + r * rowstride + w;
|
|
}
|
|
|
|
#define CUDA_CHECK(call) \
|
|
do \
|
|
{ \
|
|
cudaError_t err = call; \
|
|
if (err != cudaSuccess) \
|
|
{ \
|
|
fprintf(stderr, "CUDA error in file '%s' in line %i: %s.\n", \
|
|
__FILE__, __LINE__, cudaGetErrorString(err)); \
|
|
exit(EXIT_FAILURE); \
|
|
} \
|
|
} while (0)
|
|
|
|
#endif |