T2345: Replace instances of NULL with nullptr

The following changes have been applied to src and lib folders:
regex replace: ([^"_])NULL ⇒ \1nullptr (8968 chgs in src, 1153 in lib)
Manually find/change: (void \*) nullptr ⇒ nullptr (1 case)
regex find: ".*?nullptr.*?"
  Manually ~14 cases back to "NULL" in src, ~2 in lib
  regex finds a few false positive where nullptr appears between two
  strings in a function call
This commit is contained in:
Anne Gunn
2020-09-11 07:39:46 -06:00
parent 101d39142e
commit f1ef7d85a8
1217 changed files with 8531 additions and 8531 deletions

View File

@ -95,7 +95,7 @@ CUDPPResult cudppScan(CUDPPHandle planHandle,
size_t numElements)
{
CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppScanDispatch(d_out, d_in, numElements, 1, plan);
return CUDPP_SUCCESS;
@ -159,7 +159,7 @@ CUDPPResult cudppSegmentedScan(CUDPPHandle planHandle,
{
CUDPPSegmentedScanPlan *plan =
(CUDPPSegmentedScanPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppSegmentedScanDispatch(d_out, d_idata, d_iflags, numElements, plan);
return CUDPP_SUCCESS;
@ -200,7 +200,7 @@ CUDPPResult cudppMultiScan(CUDPPHandle planHandle,
size_t numRows)
{
CUDPPScanPlan *plan = (CUDPPScanPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppScanDispatch(d_out, d_in, numElements, numRows, plan);
return CUDPP_SUCCESS;
@ -255,7 +255,7 @@ CUDPPResult cudppCompact(CUDPPHandle planHandle,
size_t numElements)
{
CUDPPCompactPlan *plan = (CUDPPCompactPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppCompactDispatch(d_out, d_numValidElements, d_in, d_isValid,
numElements, plan);
@ -300,7 +300,7 @@ CUDPPResult cudppSort(CUDPPHandle planHandle,
size_t numElements)
{
CUDPPRadixSortPlan *plan = (CUDPPRadixSortPlan*)CUDPPPlanManager::GetPlan(planHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppRadixSortDispatch(d_keys, d_values, numElements, keyBits, plan);
return CUDPP_SUCCESS;
@ -331,7 +331,7 @@ CUDPPResult cudppSparseMatrixVectorMultiply(CUDPPHandle sparseMatrixHandl
CUDPPSparseMatrixVectorMultiplyPlan *plan =
(CUDPPSparseMatrixVectorMultiplyPlan*)CUDPPPlanManager::GetPlan(sparseMatrixHandle);
if (plan != NULL)
if (plan != nullptr)
{
cudppSparseMatrixVectorMultiplyDispatch(d_y, d_x, plan);
return CUDPP_SUCCESS;
@ -366,7 +366,7 @@ CUDPP_DLL
CUDPPResult cudppRand(CUDPPHandle planHandle,void * d_out, size_t numElements)
{
CUDPPRandPlan * plan = (CUDPPRandPlan *) CUDPPPlanManager::GetPlan(planHandle);
if(plan != NULL)
if(plan != nullptr)
{
//dispatch the rand algorithm here
cudppRandDispatch(d_out, numElements, plan);

View File

@ -18,7 +18,7 @@
#include <cassert>
CUDPPPlanManager* CUDPPPlanManager::m_instance = NULL;
CUDPPPlanManager* CUDPPPlanManager::m_instance = nullptr;
CUDPPResult validateOptions(CUDPPConfiguration config, size_t /*numElements*/, size_t numRows, size_t /*rowPitch*/)
{

View File

@ -26,17 +26,17 @@ extern "C" void compNumCTAs(KernelPointer kernel, size_t bytesDynamicSharedMem,
//! @internal Instantiate the plan manager singleton object
void CUDPPPlanManager::Instantiate()
{
if (NULL == m_instance)
if (nullptr == m_instance)
m_instance = new CUDPPPlanManager;
}
//! @internal Destroy the plan manager singleton object
void CUDPPPlanManager::Destroy()
{
if (NULL != m_instance)
if (nullptr != m_instance)
{
delete m_instance;
m_instance = NULL;
m_instance = nullptr;
}
}
@ -51,7 +51,7 @@ CUDPPPlanManager::~CUDPPPlanManager()
{
CUDPPPlan* plan = it->second;
delete plan;
plan = NULL;
plan = nullptr;
}
m_instance->plans.clear();
@ -85,7 +85,7 @@ CUDPPHandle CUDPPPlanManager::AddPlan(CUDPPPlan* plan)
*/
bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle)
{
if (m_instance == NULL)
if (m_instance == nullptr)
{
return false;
}
@ -97,7 +97,7 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle)
{
CUDPPPlan* plan = it->second;
delete plan;
plan = NULL;
plan = nullptr;
m_instance->plans.erase(it);
if (0 == m_instance->plans.size())
@ -115,14 +115,14 @@ bool CUDPPPlanManager::RemovePlan(CUDPPHandle handle)
/** @brief Get a plan from the plan manager by handle
*
* @returns A pointer to the plan if found, or NULL otherwise
* @returns A pointer to the plan if found, or nullptr otherwise
* @param handle The handle to the requested plan
*/
CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle)
{
if (m_instance == NULL)
if (m_instance == nullptr)
{
return NULL;
return nullptr;
}
std::map<CUDPPHandle, CUDPPPlan*>::iterator it;
@ -133,13 +133,13 @@ CUDPPPlan* CUDPPPlanManager::GetPlan(CUDPPHandle handle)
}
else
{
return NULL;
return nullptr;
}
}
size_t CUDPPPlanManager::numCTAs(KernelPointer kernel)
{
if (m_instance == NULL)
if (m_instance == nullptr)
{
return 0;
}

View File

@ -136,7 +136,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -152,7 +152,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -168,7 +168,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -183,7 +183,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -199,7 +199,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -215,7 +215,7 @@ extern "C" {
//! @param data uninitialized pointer, returned initialized and pointing to
//! the data read
//! @param len number of data elements in data, -1 on error
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -307,7 +307,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -350,7 +350,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -366,7 +366,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////
@ -381,7 +381,7 @@ extern "C" {
//! @param data handle to the data read
//! @param w width of the image
//! @param h height of the image
//! @note If a NULL pointer is passed to this function and it is
//! @note If a nullptr pointer is passed to this function and it is
//! initialized within Cutil then cutFree() has to be used to
//! deallocate the memory
////////////////////////////////////////////////////////////////////////////

View File

@ -261,7 +261,7 @@ class UCL_Device {
/// Select the platform that has accelerators (for compatibility with OpenCL)
inline int set_platform_accelerator(int pid=-1) { return UCL_SUCCESS; }
inline int load_module(const void* program, hipModule_t& module, std::string *log=NULL){
inline int load_module(const void* program, hipModule_t& module, std::string *log=nullptr){
auto it = _loaded_modules.emplace(program, hipModule_t());
if(!it.second){
module = it.first->second;
@ -281,7 +281,7 @@ class UCL_Device {
hipError_t err=hipModuleLoadDataEx(&module,program,num_opts, options,(void **)values);
if (log!=NULL)
if (log!=nullptr)
*log=std::string(clog);
if (err != hipSuccess) {

View File

@ -30,7 +30,7 @@ class UCL_Program {
public:
inline UCL_Program(UCL_Device &device) { _device_ptr = &device; _cq=device.cq(); }
inline UCL_Program(UCL_Device &device, const void *program,
const char *flags="", std::string *log=NULL) {
const char *flags="", std::string *log=nullptr) {
_device_ptr = &device; _cq=device.cq();
init(device);
load_string(program,flags,log);
@ -46,7 +46,7 @@ class UCL_Program {
inline void clear() { }
/// Load a program from a file and compile with flags
inline int load(const char *filename, const char *flags="", std::string *log=NULL) {
inline int load(const char *filename, const char *flags="", std::string *log=nullptr) {
std::ifstream in(filename);
if (!in || in.is_open()==false) {
#ifndef UCL_NO_EXIT
@ -64,7 +64,7 @@ class UCL_Program {
}
/// Load a program from a string and compile with flags
inline int load_string(const void *program, const char *flags="", std::string *log=NULL) {
inline int load_string(const void *program, const char *flags="", std::string *log=nullptr) {
return _device_ptr->load_module(program, _module, log);
}
@ -263,7 +263,7 @@ class UCL_Kernel {
};
const auto res = hipModuleLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1],
_num_blocks[2],_block_size[0],_block_size[1],
_block_size[2],0,_cq, NULL, config);
_block_size[2],0,_cq, nullptr, config);
CU_SAFE_CALL(res);
//#endif
}

View File

@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined);
else
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault);
if (err!=hipSuccess || *(mat.host_ptr())==NULL)
if (err!=hipSuccess || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=cm.cq();
return UCL_SUCCESS;
@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined);
else
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault);
if (err!=hipSuccess || *(mat.host_ptr())==NULL)
if (err!=hipSuccess || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=dev.cq();
return UCL_SUCCESS;
@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) {
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocWriteCombined);
else
err=hipHostMalloc((void **)mat.host_ptr(),n,hipHostMallocDefault);
if (err!=hipSuccess || *(mat.host_ptr())==NULL)
if (err!=hipSuccess || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
}

View File

@ -99,7 +99,7 @@ class UCL_Texture {
else
CU_SAFE_CALL(hipTexRefSetFormat(_tex,HIP_AD_FORMAT_SIGNED_INT32,numel*2));
}
CU_SAFE_CALL(hipTexRefSetAddress(NULL, _tex, vec.cbegin(), vec.numel()*vec.element_size()));
CU_SAFE_CALL(hipTexRefSetAddress(nullptr, _tex, vec.cbegin(), vec.numel()*vec.element_size()));
#else
void* data_ptr = (void*)vec.cbegin();
CU_SAFE_CALL(hipMemcpyHtoD(hipDeviceptr_t(_device_ptr_to_global_var), &data_ptr, sizeof(void*)));

View File

@ -41,7 +41,7 @@ class UCL_Program {
public:
inline UCL_Program(UCL_Device &device) { _cq=device.cq(); }
inline UCL_Program(UCL_Device &device, const void *program,
const char *flags="", std::string *log=NULL) {
const char *flags="", std::string *log=nullptr) {
_cq=device.cq();
init(device);
load_string(program,flags,log);
@ -58,7 +58,7 @@ class UCL_Program {
/// Load a program from a file and compile with flags
inline int load(const char *filename, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
std::ifstream in(filename);
if (!in || in.is_open()==false) {
#ifndef UCL_NO_EXIT
@ -77,7 +77,7 @@ class UCL_Program {
/// Load a program from a string and compile with flags
inline int load_string(const void *program, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
if (std::string(flags)=="BINARY")
return load_binary((const char *)program);
const unsigned int num_opts=2;
@ -95,7 +95,7 @@ class UCL_Program {
CUresult err=cuModuleLoadDataEx(&_module,program,num_opts,
options,(void **)values);
if (log!=NULL)
if (log!=nullptr)
*log=std::string(clog);
if (err != CUDA_SUCCESS) {
@ -361,7 +361,7 @@ class UCL_Kernel {
#if CUDA_VERSION >= 4000
CU_SAFE_CALL(cuLaunchKernel(_kernel,_num_blocks[0],_num_blocks[1],
_num_blocks[2],_block_size[0],_block_size[1],
_block_size[2],0,_cq,_kernel_args,NULL));
_block_size[2],0,_cq,_kernel_args,nullptr));
#else
CU_SAFE_CALL(cuParamSetSize(_kernel,_param_size));
CU_SAFE_CALL(cuLaunchGridAsync(_kernel,_num_blocks[0],_num_blocks[1],_cq));

View File

@ -55,7 +55,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED);
else
err=cuMemAllocHost((void **)mat.host_ptr(),n);
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL)
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=cm.cq();
return UCL_SUCCESS;
@ -71,7 +71,7 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED);
else
err=cuMemAllocHost((void **)mat.host_ptr(),n);
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL)
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
mat.cq()=dev.cq();
return UCL_SUCCESS;
@ -97,7 +97,7 @@ inline int _host_resize(mat_type &mat, const size_t n) {
err=cuMemHostAlloc((void **)mat.host_ptr(),n,CU_MEMHOSTALLOC_WRITECOMBINED);
else
err=cuMemAllocHost((void **)mat.host_ptr(),n);
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==NULL)
if (err!=CUDA_SUCCESS || *(mat.host_ptr())==nullptr)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
}

View File

@ -80,7 +80,7 @@ class UCL_Texture {
#ifdef UCL_DEBUG
assert(numel!=0 && numel<5);
#endif
CU_SAFE_CALL(cuTexRefSetAddress(NULL, _tex, vec.cbegin(),
CU_SAFE_CALL(cuTexRefSetAddress(nullptr, _tex, vec.cbegin(),
vec.numel()*vec.element_size()));
if (vec.element_size()==sizeof(float))
CU_SAFE_CALL(cuTexRefSetFormat(_tex, CU_AD_FORMAT_FLOAT, numel));

View File

@ -360,7 +360,7 @@ int UCL_Device::set_platform(int pid) {
// --- Get Number of Devices
cl_uint n;
errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,NULL,&n);
errorv=clGetDeviceIDs(_cl_platform,CL_DEVICE_TYPE_ALL,0,nullptr,&n);
_num_devices=n;
if (errorv!=CL_SUCCESS || _num_devices==0) {
_num_devices=0;
@ -385,7 +385,7 @@ int UCL_Device::create_context() {
props[0]=CL_CONTEXT_PLATFORM;
props[1]=_platform;
props[2]=0;
_context=clCreateContext(0,1,&_cl_device,NULL,NULL,&errorv);
_context=clCreateContext(0,1,&_cl_device,nullptr,nullptr,&errorv);
if (errorv!=CL_SUCCESS) {
#ifndef UCL_NO_EXIT
std::cerr << "UCL Error: Could not access accelerator number " << _device
@ -404,36 +404,36 @@ void UCL_Device::add_properties(cl_device_id device_list) {
char buffer[1024];
cl_bool ans_bool;
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,NULL));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_NAME,1024,buffer,nullptr));
op.name=buffer;
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_GLOBAL_MEM_SIZE,
sizeof(op.global_mem),&op.global_mem,NULL));
sizeof(op.global_mem),&op.global_mem,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_LOCAL_MEM_SIZE,
sizeof(op.shared_mem),&op.shared_mem,NULL));
sizeof(op.shared_mem),&op.shared_mem,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,
sizeof(op.const_mem),&op.const_mem,NULL));
sizeof(op.const_mem),&op.const_mem,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_TYPE,
sizeof(op.device_type),&op.device_type,NULL));
sizeof(op.device_type),&op.device_type,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_COMPUTE_UNITS,
sizeof(op.compute_units),&op.compute_units,
NULL));
nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_CLOCK_FREQUENCY,
sizeof(op.clock),&op.clock,NULL));
sizeof(op.clock),&op.clock,nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_GROUP_SIZE,
sizeof(op.work_group_size),&op.work_group_size,
NULL));
nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MAX_WORK_ITEM_SIZES,
3*sizeof(op.work_item_size[0]),op.work_item_size,
NULL));
nullptr));
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_MEM_BASE_ADDR_ALIGN,
sizeof(cl_uint),&op.alignment,NULL));
sizeof(cl_uint),&op.alignment,nullptr));
op.alignment/=8;
// Determine if double precision is supported
cl_uint double_width;
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE,
sizeof(double_width),&double_width,NULL));
sizeof(double_width),&double_width,nullptr));
if (double_width==0)
op.double_precision=false;
else
@ -441,13 +441,13 @@ void UCL_Device::add_properties(cl_device_id device_list) {
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_PROFILING_TIMER_RESOLUTION,
sizeof(size_t),&op.timer_resolution,NULL));
sizeof(size_t),&op.timer_resolution,nullptr));
op.ecc_support=false;
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_ERROR_CORRECTION_SUPPORT,
sizeof(ans_bool),&ans_bool,NULL));
sizeof(ans_bool),&ans_bool,nullptr));
if (ans_bool==CL_TRUE)
op.ecc_support=true;
@ -459,7 +459,7 @@ void UCL_Device::add_properties(cl_device_id device_list) {
#ifdef CL_VERSION_1_2
size_t return_bytes;
CL_SAFE_CALL(clGetDeviceInfo(device_list,CL_DEVICE_OPENCL_C_VERSION,1024,
buffer,NULL));
buffer,nullptr));
op.c_version=buffer;
cl_device_partition_property pinfo[4];
@ -479,7 +479,7 @@ void UCL_Device::add_properties(cl_device_id device_list) {
CL_SAFE_CALL(clGetDeviceInfo(device_list,
CL_DEVICE_PARTITION_MAX_SUB_DEVICES,
sizeof(cl_uint),&op.max_sub_devices,NULL));
sizeof(cl_uint),&op.max_sub_devices,nullptr));
#endif
_properties.push_back(op);
@ -489,15 +489,15 @@ std::string UCL_Device::platform_name() {
char info[1024];
CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VENDOR,1024,info,
NULL));
nullptr));
std::string ans=std::string(info)+' ';
CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_NAME,1024,info,
NULL));
nullptr));
ans+=std::string(info)+' ';
CL_SAFE_CALL(clGetPlatformInfo(_cl_platform,CL_PLATFORM_VERSION,1024,info,
NULL));
nullptr));
ans+=std::string(info);
return ans;

View File

@ -42,7 +42,7 @@ class UCL_Program {
inline UCL_Program() : _init_done(false) {}
inline UCL_Program(UCL_Device &device) : _init_done(false) { init(device); }
inline UCL_Program(UCL_Device &device, const void *program,
const char *flags="", std::string *log=NULL) :
const char *flags="", std::string *log=nullptr) :
_init_done(false) {
init(device);
load_string(program,flags,log);
@ -74,7 +74,7 @@ class UCL_Program {
/// Load a program from a file and compile with flags
inline int load(const char *filename, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
std::ifstream in(filename);
if (!in || in.is_open()==false) {
#ifndef UCL_NO_EXIT
@ -93,29 +93,29 @@ class UCL_Program {
/// Load a program from a string and compile with flags
inline int load_string(const void *program, const char *flags="",
std::string *log=NULL) {
std::string *log=nullptr) {
cl_int error_flag;
const char *prog=(const char *)program;
_program=clCreateProgramWithSource(_context,1,&prog,NULL,&error_flag);
_program=clCreateProgramWithSource(_context,1,&prog,nullptr,&error_flag);
CL_CHECK_ERR(error_flag);
error_flag = clBuildProgram(_program,1,&_device,flags,NULL,NULL);
error_flag = clBuildProgram(_program,1,&_device,flags,nullptr,nullptr);
if (error_flag!=-11)
CL_CHECK_ERR(error_flag);
cl_build_status build_status;
CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,
CL_PROGRAM_BUILD_STATUS,
sizeof(cl_build_status),&build_status,
NULL));
nullptr));
if (build_status != CL_SUCCESS || log!=NULL) {
if (build_status != CL_SUCCESS || log!=nullptr) {
size_t ms;
CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,0,
NULL, &ms));
nullptr, &ms));
char *build_log = new char[ms];
CL_SAFE_CALL(clGetProgramBuildInfo(_program,_device,CL_PROGRAM_BUILD_LOG,ms,
build_log, NULL));
build_log, nullptr));
if (log!=NULL)
if (log!=nullptr)
*log=std::string(build_log);
if (build_status != CL_SUCCESS) {
@ -363,7 +363,7 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function)
_kernel_info_name=function;
cl_uint nargs;
CL_SAFE_CALL(clGetKernelInfo(_kernel,CL_KERNEL_NUM_ARGS,sizeof(cl_uint),
&nargs,NULL));
&nargs,nullptr));
_kernel_info_nargs=nargs;
#ifdef NOT_TEST_CL_VERSION_1_2
char tname[256];
@ -380,8 +380,8 @@ inline int UCL_Kernel::set_function(UCL_Program &program, const char *function)
}
void UCL_Kernel::run() {
CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,NULL,
_num_blocks,_block_size,0,NULL,NULL));
CL_SAFE_CALL(clEnqueueNDRangeKernel(_cq,_kernel,_dimensions,nullptr,
_num_blocks,_block_size,0,nullptr,nullptr));
}
} // namespace

View File

@ -58,7 +58,7 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
cl_int error_flag;
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags buffer_perm;
cl_map_flags map_perm;
@ -103,12 +103,12 @@ inline int _host_alloc(mat_type &mat, copy_type &cm, const size_t n,
map_perm=CL_MAP_READ | CL_MAP_WRITE;
}
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
*mat.host_ptr() = (typename mat_type::data_type*)
clEnqueueMapBuffer(cm.cq(),mat.cbegin(),CL_TRUE,
map_perm,0,n,0,NULL,NULL,NULL);
map_perm,0,n,0,nullptr,nullptr,nullptr);
mat.cq()=cm.cq();
CL_SAFE_CALL(clRetainCommandQueue(mat.cq()));
@ -120,10 +120,10 @@ inline int _host_view(mat_type &mat, copy_type &cm, const size_t n) {
cl_int error_flag;
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags orig_flags;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_FLAGS,sizeof(orig_flags),
&orig_flags,NULL));
&orig_flags,nullptr));
orig_flags=orig_flags & ~CL_MEM_ALLOC_HOST_PTR;
mat.cbegin()=clCreateBuffer(context, CL_MEM_USE_HOST_PTR | orig_flags, n,
@ -159,13 +159,13 @@ inline int _host_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
}
cl_int error_flag;
mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(dev.context(),buffer_perm,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
*mat.host_ptr() = (typename mat_type::data_type*)
clEnqueueMapBuffer(dev.cq(),mat.cbegin(),CL_TRUE,
map_perm,0,n,0,NULL,NULL,NULL);
map_perm,0,n,0,nullptr,nullptr,nullptr);
mat.cq()=dev.cq();
CL_SAFE_CALL(clRetainCommandQueue(mat.cq()));
return UCL_SUCCESS;
@ -194,10 +194,10 @@ inline int _host_resize(mat_type &mat, const size_t n) {
cl_int error_flag;
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags buffer_perm;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_FLAGS,sizeof(buffer_perm),
&buffer_perm,NULL));
&buffer_perm,nullptr));
CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin()));
@ -209,12 +209,12 @@ inline int _host_resize(mat_type &mat, const size_t n) {
else
map_perm=CL_MAP_READ | CL_MAP_WRITE;
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,buffer_perm,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
*mat.host_ptr() = (typename mat_type::data_type*)
clEnqueueMapBuffer(mat.cq(),mat.cbegin(),CL_TRUE,
map_perm,0,n,0,NULL,NULL,NULL);
map_perm,0,n,0,nullptr,nullptr,nullptr);
return UCL_SUCCESS;
}
@ -229,7 +229,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n,
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(cm.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_mem_flags flag;
if (kind==UCL_READ_WRITE)
flag=CL_MEM_READ_WRITE;
@ -247,7 +247,7 @@ inline int _device_alloc(mat_type &mat, copy_type &cm, const size_t n,
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
mat.cq()=cm.cq();
@ -276,7 +276,7 @@ inline int _device_alloc(mat_type &mat, UCL_Device &dev, const size_t n,
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(dev.context(),flag,n,NULL,
mat.cbegin()=clCreateBuffer(dev.context(),flag,n,nullptr,
&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
@ -321,7 +321,7 @@ inline int _device_resize(mat_type &mat, const size_t n) {
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin()));
cl_mem_flags flag;
@ -341,7 +341,7 @@ inline int _device_resize(mat_type &mat, const size_t n) {
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(context,flag,n,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,flag,n,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
@ -359,7 +359,7 @@ inline int _device_resize(mat_type &mat, const size_t rows,
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
CL_DESTRUCT_CALL(clReleaseMemObject(mat.cbegin()));
cl_mem_flags flag;
@ -379,7 +379,7 @@ inline int _device_resize(mat_type &mat, const size_t rows,
#endif
else
assert(0==1);
mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,NULL,&error_flag);
mat.cbegin()=clCreateBuffer(context,flag,pitch*rows,nullptr,&error_flag);
if (error_flag != CL_SUCCESS)
return UCL_MEMORY_ERROR;
return UCL_SUCCESS;
@ -395,21 +395,21 @@ inline void _host_zero(void *ptr, const size_t n) {
inline void _ocl_build(cl_program &program, cl_device_id &device,
const char* options = "") {
clBuildProgram(program,1,&device,options,NULL,NULL);
clBuildProgram(program,1,&device,options,nullptr,nullptr);
cl_build_status build_status;
CL_SAFE_CALL(clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS,
sizeof(cl_build_status),&build_status,
NULL));
nullptr));
if (build_status == CL_SUCCESS)
return;
size_t ms;
CL_SAFE_CALL(clGetProgramBuildInfo(program, device,CL_PROGRAM_BUILD_LOG, 0,
NULL, &ms));
nullptr, &ms));
char *build_log = new char[ms];
CL_SAFE_CALL(clGetProgramBuildInfo(program,device,CL_PROGRAM_BUILD_LOG,ms,
build_log, NULL));
build_log, nullptr));
std::cerr << std::endl
<< "----------------------------------------------------------\n"
@ -426,7 +426,7 @@ inline void _ocl_kernel_from_source(cl_context &context, cl_device_id &device,
cl_int error_flag;
cl_program program=clCreateProgramWithSource(context,lines,source,
NULL,&error_flag);
nullptr,&error_flag);
CL_CHECK_ERR(error_flag);
_ocl_build(program,device,options);
kernel=clCreateKernel(program,function,&error_flag);
@ -444,15 +444,15 @@ inline void _device_zero(mat_type &mat, const size_t n, command_queue &cq) {
#ifdef UCL_CL_ZERO
cl_int zeroint=0;
CL_SAFE_CALL(clEnqueueFillBuffer(cq,mat.begin(),&zeroint,sizeof(cl_int),
mat.byteoff(),n,0,NULL,NULL));
mat.byteoff(),n,0,nullptr,nullptr));
#else
cl_context context;
CL_SAFE_CALL(clGetMemObjectInfo(mat.cbegin(),CL_MEM_CONTEXT,sizeof(context),
&context,NULL));
&context,nullptr));
cl_device_id device;
CL_SAFE_CALL(clGetContextInfo(context,CL_CONTEXT_DEVICES,
sizeof(cl_device_id),&device,NULL));
sizeof(cl_device_id),&device,nullptr));
const char * szero[3]={
"#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n",
@ -585,7 +585,7 @@ template <> struct _ucl_memcpy<1,0> {
std::cerr << "UCL_COPY 1NS\n";
#endif
CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,n,
dst.begin(),0,NULL,NULL));
dst.begin(),0,nullptr,nullptr));
}
template <class p1, class p2>
static inline void mc(p1 &dst, const size_t dpitch, const p2 &src,
@ -607,13 +607,13 @@ template <> struct _ucl_memcpy<1,0> {
src.cols()==cols/src.element_size())
CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,
spitch*rows,
(char *)dst.begin()+dst_offset,0,NULL,
NULL));
(char *)dst.begin()+dst_offset,0,nullptr,
nullptr));
else
for (size_t i=0; i<rows; i++) {
CL_SAFE_CALL(clEnqueueReadBuffer(cq,src.cbegin(),block,src_offset,cols,
(char *)dst.begin()+dst_offset,0,NULL,
NULL));
(char *)dst.begin()+dst_offset,0,nullptr,
nullptr));
src_offset+=spitch;
dst_offset+=dpitch;
}
@ -637,7 +637,7 @@ template <> struct _ucl_memcpy<0,1> {
std::cerr << "UCL_COPY 3NS\n";
#endif
CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,n,
src.begin(),0,NULL,NULL));
src.begin(),0,nullptr,nullptr));
}
template <class p1, class p2>
static inline void mc(p1 &dst, const size_t dpitch, const p2 &src,
@ -659,13 +659,13 @@ template <> struct _ucl_memcpy<0,1> {
src.cols()==cols/src.element_size())
CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,
spitch*rows,
(char *)src.begin()+src_offset,0,NULL,
NULL));
(char *)src.begin()+src_offset,0,nullptr,
nullptr));
else
for (size_t i=0; i<rows; i++) {
CL_SAFE_CALL(clEnqueueWriteBuffer(cq,dst.cbegin(),block,dst_offset,cols,
(char *)src.begin()+src_offset,0,NULL,
NULL));
(char *)src.begin()+src_offset,0,nullptr,
nullptr));
src_offset+=spitch;
dst_offset+=dpitch;
}
@ -680,7 +680,7 @@ template <int mem1, int mem2> struct _ucl_memcpy {
const size_t dst_offset, const size_t src_offset) {
if (src.cbegin()!=dst.cbegin() || src_offset!=dst_offset) {
CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset,
dst_offset,n,0,NULL,NULL));
dst_offset,n,0,nullptr,nullptr));
#ifdef UCL_DBG_MEM_TRACE
std::cerr << "UCL_COPY 6NS\n";
#endif
@ -704,13 +704,13 @@ template <int mem1, int mem2> struct _ucl_memcpy {
if (spitch==dpitch && dst.cols()==src.cols() &&
src.cols()==cols/src.element_size())
CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),src_offset,
dst_offset,spitch*rows,0,NULL,NULL));
dst_offset,spitch*rows,0,nullptr,nullptr));
else
for (size_t i=0; i<rows; i++) {
CL_SAFE_CALL(clEnqueueCopyBuffer(cq,src.cbegin(),dst.cbegin(),
src_offset,dst_offset,cols,0,
NULL,NULL));
nullptr,nullptr));
src_offset+=spitch;
dst_offset+=dpitch;
}

View File

@ -28,7 +28,7 @@
#include "ocl_device.h"
#ifdef CL_VERSION_1_2
#define UCL_OCL_MARKER(cq,event) clEnqueueMarkerWithWaitList(cq,0,NULL,event)
#define UCL_OCL_MARKER(cq,event) clEnqueueMarkerWithWaitList(cq,0,nullptr,event)
#else
#define UCL_OCL_MARKER clEnqueueMarker
#endif
@ -117,10 +117,10 @@ class UCL_Timer {
CL_SAFE_CALL(clWaitForEvents(1,&stop_event));
CL_SAFE_CALL(clGetEventProfilingInfo(stop_event,
CL_PROFILING_COMMAND_START,
sizeof(cl_ulong), &tend, NULL));
sizeof(cl_ulong), &tend, nullptr));
CL_SAFE_CALL(clGetEventProfilingInfo(start_event,
CL_PROFILING_COMMAND_END,
sizeof(cl_ulong), &tstart, NULL));
sizeof(cl_ulong), &tstart, nullptr));
clReleaseEvent(start_event);
clReleaseEvent(stop_event);
has_measured_time = false;

View File

@ -75,10 +75,10 @@ class UCL_BaseMat {
#ifdef _OCL_MAT
cl_device_id device;
CL_SAFE_CALL(clGetCommandQueueInfo(_cq,CL_QUEUE_DEVICE,
sizeof(cl_device_id),&device,NULL));
sizeof(cl_device_id),&device,nullptr));
cl_device_type device_type;
CL_SAFE_CALL(clGetDeviceInfo(device,CL_DEVICE_TYPE,
sizeof(device_type),&device_type,NULL));
sizeof(device_type),&device_type,nullptr));
return _shared_mem_device(device_type);
#else
return false;

View File

@ -438,7 +438,7 @@ class UCL_D_Vec : public UCL_BaseMat {
(*_tex_ptr).addressMode[1] = cudaAddressModeClamp;
(*_tex_ptr).filterMode = cudaFilterModePoint;
(*_tex_ptr).normalized = false;
CUDA_SAFE_CALL(cudaBindTexture(NULL,_tex_ptr,_array,&_channel));
CUDA_SAFE_CALL(cudaBindTexture(nullptr,_tex_ptr,_array,&_channel));
}
/// For CUDA-RT, unbind texture
inline void unbind() { CUDA_SAFE_CALL(cudaUnbindTexture(_tex_ptr)); }

View File

@ -20,7 +20,7 @@ namespace LAMMPS_AL {
template <class numtyp, class acctyp>
AnswerT::Answer() : _allocated(false),_eflag(false),_vflag(false),
_inum(0),_ilist(NULL),_newton(false) {
_inum(0),_ilist(nullptr),_newton(false) {
}
template <class numtyp, class acctyp>
@ -119,7 +119,7 @@ void AnswerT::clear() {
engv.clear();
time_answer.clear();
_inum=0;
_ilist=NULL;
_ilist=nullptr;
_eflag=false;
_vflag=false;
}
@ -180,7 +180,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
for (int i=0; i<_inum; i++)
evdwl+=engv[i];
if (_ef_atom) {
if (_ilist==NULL) {
if (_ilist==nullptr) {
for (int i=0; i<_inum; i++)
eatom[i]+=engv[i];
} else {
@ -196,7 +196,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
for (int i=vstart; i<iend; i++)
virial[j]+=engv[i];
if (_vf_atom){
if (_ilist==NULL) {
if (_ilist==nullptr) {
int ii=0;
for (int i=vstart; i<iend; i++)
vatom[ii++][j]+=engv[i];
@ -232,7 +232,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
for (int i=_inum; i<iend; i++)
ecoul+=engv[i];
if (_ef_atom) {
if (_ilist==NULL) {
if (_ilist==nullptr) {
for (int i=0; i<_inum; i++)
eatom[i]+=engv[i];
for (int i=_inum; i<iend; i++)
@ -252,7 +252,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
for (int i=vstart; i<iend; i++)
virial[j]+=engv[i];
if (_vf_atom) {
if (_ilist==NULL) {
if (_ilist==nullptr) {
for (int i=vstart, ii=0; i<iend; i++)
vatom[ii++][j]+=engv[i];
} else {
@ -271,7 +271,7 @@ double AnswerT::energy_virial(double *eatom, double **vatom,
template <class numtyp, class acctyp>
void AnswerT::get_answers(double **f, double **tor) {
int fl=0;
if (_ilist==NULL) {
if (_ilist==nullptr) {
for (int i=0; i<_inum; i++) {
f[i][0]+=force[fl];
f[i][1]+=force[fl+1];

View File

@ -25,8 +25,8 @@ BaseAtomicT::BaseAtomic() : _compiled(false), _max_bytes(0) {
device=&global_device;
ans=new Answer<numtyp,acctyp>();
nbor=new Neighbor();
pair_program=NULL;
ucl_device=NULL;
pair_program=nullptr;
ucl_device=nullptr;
}
template <class numtyp, class acctyp>
@ -135,7 +135,7 @@ int * BaseAtomicT::reset_nbors(const int nall, const int inum, int *ilist,
resize_atom(inum,nall,success);
resize_local(inum,mn,success);
if (!success)
return NULL;
return nullptr;
nbor->get_host(inum,ilist,numj,firstneigh,block_size());
@ -231,7 +231,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full,
// Make sure textures are correct if realloc by a different hybrid style
resize_atom(0,nall,success);
zero_timers();
return NULL;
return nullptr;
}
hd_balancer.balance(cpu_time);
@ -244,7 +244,7 @@ int ** BaseAtomicT::compute(const int ago, const int inum_full,
build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
hd_balancer.start_timer();
} else {
atom->cast_x_data(host_x,host_type);

View File

@ -25,8 +25,8 @@ BaseChargeT::BaseCharge() : _compiled(false), _max_bytes(0) {
device=&global_device;
ans=new Answer<numtyp,acctyp>();
nbor=new Neighbor();
pair_program=NULL;
ucl_device=NULL;
pair_program=nullptr;
ucl_device=nullptr;
}
template <class numtyp, class acctyp>
@ -137,7 +137,7 @@ int * BaseChargeT::reset_nbors(const int nall, const int inum, int *ilist,
resize_atom(inum,nall,success);
resize_local(inum,mn,success);
if (!success)
return NULL;
return nullptr;
nbor->get_host(inum,ilist,numj,firstneigh,block_size());
@ -240,7 +240,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full,
// Make sure textures are correct if realloc by a different hybrid style
resize_atom(0,nall,success);
zero_timers();
return NULL;
return nullptr;
}
hd_balancer.balance(cpu_time);
@ -253,7 +253,7 @@ int** BaseChargeT::compute(const int ago, const int inum_full,
build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
atom->cast_q_data(host_q);
hd_balancer.start_timer();
} else {

View File

@ -25,8 +25,8 @@ BaseDipoleT::BaseDipole() : _compiled(false), _max_bytes(0) {
device=&global_device;
ans=new Answer<numtyp,acctyp>();
nbor=new Neighbor();
pair_program=NULL;
ucl_device=NULL;
pair_program=nullptr;
ucl_device=nullptr;
}
template <class numtyp, class acctyp>
@ -139,7 +139,7 @@ int * BaseDipoleT::reset_nbors(const int nall, const int inum, int *ilist,
resize_atom(inum,nall,success);
resize_local(inum,mn,success);
if (!success)
return NULL;
return nullptr;
nbor->get_host(inum,ilist,numj,firstneigh,block_size());
@ -245,7 +245,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full,
// Make sure textures are correct if realloc by a different hybrid style
resize_atom(0,nall,success);
zero_timers();
return NULL;
return nullptr;
}
hd_balancer.balance(cpu_time);
@ -258,7 +258,7 @@ int** BaseDipoleT::compute(const int ago, const int inum_full,
build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
atom->cast_q_data(host_q);
atom->cast_quat_data(host_mu[0]);
hd_balancer.start_timer();

View File

@ -25,8 +25,8 @@ BaseDPDT::BaseDPD() : _compiled(false), _max_bytes(0) {
device=&global_device;
ans=new Answer<numtyp,acctyp>();
nbor=new Neighbor();
pair_program=NULL;
ucl_device=NULL;
pair_program=nullptr;
ucl_device=nullptr;
}
template <class numtyp, class acctyp>
@ -138,7 +138,7 @@ int * BaseDPDT::reset_nbors(const int nall, const int inum, int *ilist,
resize_atom(inum,nall,success);
resize_local(inum,mn,success);
if (!success)
return NULL;
return nullptr;
nbor->get_host(inum,ilist,numj,firstneigh,block_size());
@ -245,7 +245,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full,
// Make sure textures are correct if realloc by a different hybrid style
resize_atom(0,nall,success);
zero_timers();
return NULL;
return nullptr;
}
hd_balancer.balance(cpu_time);
@ -258,7 +258,7 @@ int** BaseDPDT::compute(const int ago, const int inum_full,
build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
atom->cast_v_data(host_v,tag);
hd_balancer.start_timer();
} else {

View File

@ -33,10 +33,10 @@ BaseEllipsoidT::BaseEllipsoid() : _compiled(false), _max_bytes(0) {
device=&global_device;
ans=new Answer<numtyp,acctyp>();
nbor=new Neighbor();
nbor_program=NULL;
ellipsoid_program=NULL;
lj_program=NULL;
ucl_device=NULL;
nbor_program=nullptr;
ellipsoid_program=nullptr;
lj_program=nullptr;
ucl_device=nullptr;
}
template <class numtyp, class acctyp>
@ -356,7 +356,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full,
if (inum_full==0) {
host_start=0;
zero_timers();
return NULL;
return nullptr;
}
int ago=hd_balancer.ago_first(f_ago);
@ -369,7 +369,7 @@ int* BaseEllipsoidT::compute(const int f_ago, const int inum_full,
reset_nbors(nall, inum, inum_full, ilist, numj, host_type, firstneigh,
success);
if (!success)
return NULL;
return nullptr;
}
int *list;
if (_multiple_forms)
@ -406,7 +406,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall
if (inum_full==0) {
host_start=0;
zero_timers();
return NULL;
return nullptr;
}
hd_balancer.balance(cpu_time);
@ -420,7 +420,7 @@ int** BaseEllipsoidT::compute(const int ago, const int inum_full, const int nall
build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
atom->cast_quat_data(host_quat[0]);
hd_balancer.start_timer();
} else {

View File

@ -27,8 +27,8 @@ BaseThreeT::BaseThree() : _compiled(false), _max_bytes(0) {
#ifdef THREE_CONCURRENT
ans2=new Answer<numtyp,acctyp>();
#endif
pair_program=NULL;
ucl_device=NULL;
pair_program=nullptr;
ucl_device=nullptr;
}
template <class numtyp, class acctyp>
@ -176,7 +176,7 @@ int * BaseThreeT::reset_nbors(const int nall, const int inum, const int nlist,
resize_atom(inum,nall,success);
resize_local(nall,mn,success);
if (!success)
return NULL;
return nullptr;
_nall = nall;
@ -310,7 +310,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full,
// Make sure textures are correct if realloc by a different hybrid style
resize_atom(0,nall,success);
zero_timers();
return NULL;
return nullptr;
}
hd_balancer.balance(cpu_time);
@ -326,7 +326,7 @@ int ** BaseThreeT::compute(const int ago, const int inum_full,
_max_nbors = build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
hd_balancer.start_timer();
} else {
atom->cast_x_data(host_x,host_type);

View File

@ -59,7 +59,7 @@ class BaseThree {
const double gpu_split, FILE *screen,
const void *pair_program, const char *k_two,
const char *k_three_center, const char *k_three_end,
const char *k_short_nbor=NULL);
const char *k_short_nbor=nullptr);
/// Estimate the overhead for GPU context changes and CPU driver
void estimate_gpu_overhead();

View File

@ -72,7 +72,7 @@ int DeviceT::init_device(MPI_Comm world, MPI_Comm replica, const int first_gpu,
// "0:generic" will select platform 0 and tune for generic device
// "1:fermi" will select platform 1 and tune for Nvidia Fermi gpu
if (ocl_vendor) {
char *sep = NULL;
char *sep = nullptr;
if ((sep = strstr(ocl_vendor,":"))) {
*sep = '\0';
_platform_id = atoi(ocl_vendor);
@ -182,7 +182,7 @@ template <class numtyp, class acctyp>
int DeviceT::set_ocl_params(char *ocl_vendor) {
#ifdef USE_OPENCL
std::string s_vendor=OCL_DEFAULT_VENDOR;
if (ocl_vendor!=NULL)
if (ocl_vendor!=nullptr)
s_vendor=ocl_vendor;
if (s_vendor=="none")
s_vendor="generic";
@ -215,14 +215,14 @@ int DeviceT::set_ocl_params(char *ocl_vendor) {
int token_count=0;
std::string params[13];
char *pch = strtok(ocl_vendor,",");
pch = strtok(NULL,",");
if (pch == NULL) return -11;
while (pch != NULL) {
pch = strtok(nullptr,",");
if (pch == nullptr) return -11;
while (pch != nullptr) {
if (token_count==13)
return -11;
params[token_count]=pch;
token_count++;
pch = strtok(NULL,",");
pch = strtok(nullptr,",");
}
_ocl_vendor_string+=" -DMEM_THREADS="+params[0]+
" -DTHREADS_PER_ATOM="+params[1]+
@ -430,9 +430,9 @@ template <class numtyp, class acctyp>
void DeviceT::estimate_gpu_overhead(const int kernel_calls,
double &gpu_overhead,
double &gpu_driver_overhead) {
UCL_H_Vec<int> *host_data_in=NULL, *host_data_out=NULL;
UCL_D_Vec<int> *dev_data_in=NULL, *dev_data_out=NULL, *kernel_data=NULL;
UCL_Timer *timers_in=NULL, *timers_out=NULL, *timers_kernel=NULL;
UCL_H_Vec<int> *host_data_in=nullptr, *host_data_out=nullptr;
UCL_D_Vec<int> *dev_data_in=nullptr, *dev_data_out=nullptr, *kernel_data=nullptr;
UCL_Timer *timers_in=nullptr, *timers_out=nullptr, *timers_kernel=nullptr;
UCL_Timer over_timer(*gpu);
if (_data_in_estimate>0) {

View File

@ -380,7 +380,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall,
// Make sure textures are correct if realloc by a different hybrid style
this->resize_atom(0,nall,success);
this->zero_timers();
return NULL;
return nullptr;
}
// load balance, returning the atom count on the device (inum)
@ -394,7 +394,7 @@ int** EAMT::compute(const int ago, const int inum_full, const int nall,
this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
} else {
this->atom->cast_x_data(host_x,host_type);
this->atom->add_x_data(host_x,host_type);
@ -429,7 +429,7 @@ void EAMT::compute2(int *ilist, const bool eflag, const bool vflag,
time_fp2.stop();
loop2(eflag,vflag);
if (ilist == NULL)
if (ilist == nullptr)
this->ans->copy_answers(eflag,vflag,eatom,vatom);
else
this->ans->copy_answers(eflag,vflag,eatom,vatom, ilist);

View File

@ -340,7 +340,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full,
// Make sure textures are correct if realloc by a different hybrid style
this->resize_atom(0,nall,success);
this->zero_timers();
return NULL;
return nullptr;
}
this->hd_balancer.balance(cpu_time);
@ -353,7 +353,7 @@ int** LJTIP4PLongT::compute(const int ago, const int inum_full,
this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
this->atom->cast_q_data(host_q);
this->hd_balancer.start_timer();
} else {

View File

@ -158,7 +158,7 @@ void Neighbor::alloc(bool &success) {
}
_c_bytes+=nbor_host.device.row_bytes()+dev_numj_host.row_bytes();
} else {
// Some OpenCL implementations return errors for NULL pointers as args
// Some OpenCL implementations return errors for nullptr pointers as args
nbor_host.device.view(dev_nbor);
dev_numj_host.view(dev_nbor);
}

View File

@ -35,7 +35,7 @@ PPPMT::PPPM() : _allocated(false), _compiled(false),
_max_bytes(0) {
device=&global_device;
ans=new Answer<numtyp,acctyp>();
pppm_program=NULL;
pppm_program=nullptr;
}
template <class numtyp, class acctyp, class grdtyp, class grdtyp4>

View File

@ -56,7 +56,7 @@ grdtyp * pppm_gpu_init(memtyp &pppm, const int nlocal, const int nall,
}
success=0;
grdtyp * host_brick=NULL;
grdtyp * host_brick=nullptr;
if (world_me==0)
host_brick=pppm.init(nlocal,nall,screen,order,nxlo_out,nylo_out,nzlo_out,
nxhi_out,nyhi_out,nzhi_out,rho_coeff,vd_brick,
@ -129,7 +129,7 @@ double pppm_gpu_bytes_f() {
void pppm_gpu_forces_f(double **f) {
double etmp;
PPPMF.atom->data_unavail();
PPPMF.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp);
PPPMF.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp);
}
double * pppm_gpu_init_d(const int nlocal, const int nall, FILE *screen,
@ -173,6 +173,6 @@ double pppm_gpu_bytes_d() {
void pppm_gpu_forces_d(double **f) {
double etmp;
PPPMD.atom->data_unavail();
PPPMD.ans->get_answers(f,NULL,NULL,NULL,NULL,etmp);
PPPMD.ans->get_answers(f,nullptr,nullptr,nullptr,nullptr,etmp);
}

View File

@ -213,7 +213,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall
// Make sure textures are correct if realloc by a different hybrid style
this->resize_atom(0,nall,success);
this->zero_timers();
return NULL;
return nullptr;
}
// load balance, returning the atom count on the device (inum)
@ -227,7 +227,7 @@ int** YukawaColloidT::compute(const int ago, const int inum_full, const int nall
this->build_nbor_list(inum, inum_full-inum, nall, host_x, host_type,
sublo, subhi, tag, nspecial, special, success);
if (!success)
return NULL;
return nullptr;
this->cast_rad_data(rad);
this->hd_balancer.start_timer();
} else {