Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/source_base/intarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ModuleBase
class IntArray
{
public:
int *ptr;
int * ptr = nullptr;

/**
* @brief Construct a new Int Array object
Expand Down
4 changes: 2 additions & 2 deletions source/source_base/math_chebyshev.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ class FFTW<double>
~FFTW();
void execute_fftw();
double* dcoef; //[norder2]
fftw_complex* ccoef;
fftw_complex* ccoef = nullptr;
fftw_plan coef_plan;
};

Expand All @@ -262,7 +262,7 @@ class FFTW<float>
~FFTW();
void execute_fftw();
float* dcoef; //[norder2]
fftwf_complex* ccoef;
fftwf_complex* ccoef = nullptr;
fftwf_plan coef_plan;
};
#endif
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/mathzone_add1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void Mathzone_Add1::SplineD2 // modified by pengfei 13-8-8 add second derivative
ModuleBase::timer::tick("Mathzone_Add1","SplineD2");

double dx1, dx2, dy1, dy2, p, qn, sig, un;
double *u;
double * u = nullptr;

u = new double[mesh-1];
const double ypmax = 99999.00;
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/matrix_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Matrix_Wrapper
public:
int nr;
int nc;
double *c;
double * c = nullptr;
bool flag_delete_c;

Matrix_Wrapper(): nr(0), nc(0), c(nullptr), flag_delete_c(false){}
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/matrix_wrapper_tianhe2.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ModuleBase
class Matrix_Wrapper
{
public:
double *c;
double * c = nullptr;
int nr;
int nc;

Expand Down
10 changes: 5 additions & 5 deletions source/source_base/mcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ char *MCD_strdup(const char*s,char*fun,char*file,int line)
char *MCD_strdup(char*s,char*fun,char*file,int line)
#endif
{
char *n;
char * n = nullptr;

#ifdef MCD_FASTFREE
n=(char*)malloc(sizeof(char)*strlen(s)+1+sizeof(Chunk));
Expand Down Expand Up @@ -542,7 +542,7 @@ char *MCD_strndup(const char*s, int z,char*fun,char*file,int line)
char *MCD_strndup(char*s, int z,char*fun,char*file,int line)
#endif
{
char *n;
char * n = nullptr;
int size;
if((signed)strlen(s)>z)
size=z;
Expand Down Expand Up @@ -575,7 +575,7 @@ int MCD_asprintf(char **ptr,const char *fmt,char *fun, char*file, int line,...)
int retval;
va_list argptr;
#ifdef MCD_FASTFREE
void *fc;
void * fc = nullptr;
#endif

va_start(argptr,line);
Expand Down Expand Up @@ -610,7 +610,7 @@ int MCD_vasprintf(char **ptr,const char *fmt,va_list argptr,char *fun, char*file
{
int retval;
#ifdef MCD_FASTFREE
void *fc;
void * fc = nullptr;
#endif

if((retval=vasprintf(ptr, fmt, argptr))<0)
Expand Down Expand Up @@ -781,7 +781,7 @@ void showMemStats()
Chunk*c=MemoryChunks;
int total=0;

FILE *o;
FILE * o = nullptr;

if(MemStatLog)
o=MemStatLog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ class TensorAccessorBase {
}

protected:
T* data_;
const index_t* sizes_;
const index_t* strides_;
T* data_ = nullptr;
const index_t* sizes_ = nullptr;
const index_t* strides_ = nullptr;
};

template <typename T, size_t N, typename index_t = int64_t,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace base {
namespace core {
// Allocate a block of memory with the given size and default alignment on GPU.
void *GPUAllocator::allocate(size_t size) {
void *ptr;
void * ptr = nullptr;
device_result_t result = device_malloc(&ptr, size);
if (result != device_success) {
return nullptr;
Expand All @@ -29,7 +29,7 @@ void *GPUAllocator::allocate(size_t size) {

// Allocate a block of CPU memory with the given size and alignment.
void *GPUAllocator::allocate(size_t size, size_t alignment) {
void *ptr;
void * ptr = nullptr;
device_result_t result = device_malloc(&ptr, size);
if (result != device_success) {
return nullptr;
Expand Down
16 changes: 8 additions & 8 deletions source/source_base/module_container/base/third_party/cusolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void potri (cusolverDnHandle_t& cusolver_handle, const char& uplo, const char& d
{
int lwork;
CHECK_CUSOLVER(cusolverDnSpotri_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, A, n, &lwork));
float* work;
float* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(float)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnSpotri(cusolver_handle, cublas_fill_mode(uplo), n, A, n, work, lwork, nullptr));
Expand All @@ -64,7 +64,7 @@ void potri (cusolverDnHandle_t& cusolver_handle, const char& uplo, const char& d
{
int lwork;
CHECK_CUSOLVER(cusolverDnDpotri_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, A, n, &lwork));
double* work;
double* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(double)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnDpotri(cusolver_handle, cublas_fill_mode(uplo), n, A, n, work, lwork, nullptr));
Expand All @@ -75,7 +75,7 @@ void potri (cusolverDnHandle_t& cusolver_handle, const char& uplo, const char& d
{
int lwork;
CHECK_CUSOLVER(cusolverDnCpotri_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuComplex *>(A), n, &lwork));
cuComplex* work;
cuComplex* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(cuComplex)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnCpotri(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuComplex *>(A), n, work, lwork, nullptr));
Expand All @@ -86,7 +86,7 @@ void potri (cusolverDnHandle_t& cusolver_handle, const char& uplo, const char& d
{
int lwork;
CHECK_CUSOLVER(cusolverDnZpotri_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuDoubleComplex *>(A), n, &lwork));
cuDoubleComplex* work;
cuDoubleComplex* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(cuDoubleComplex)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnZpotri(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuDoubleComplex *>(A), n, work, lwork, nullptr));
Expand All @@ -101,7 +101,7 @@ void potrf (cusolverDnHandle_t& cusolver_handle, const char& uplo, const int& n,
int *info = nullptr;
CHECK_CUDA(cudaMalloc((void**)&info, 1 * sizeof(int)));
CHECK_CUSOLVER(cusolverDnSpotrf_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, A, n, &lwork));
float* work;
float* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(float)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnSpotrf(cusolver_handle, cublas_fill_mode(uplo), n, A, n, work, lwork, info));
Expand All @@ -115,7 +115,7 @@ void potrf (cusolverDnHandle_t& cusolver_handle, const char& uplo, const int& n,
int *info = nullptr;
CHECK_CUDA(cudaMalloc((void**)&info, 1 * sizeof(int)));
CHECK_CUSOLVER(cusolverDnDpotrf_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, A, n, &lwork));
double* work;
double* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(double)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnDpotrf(cusolver_handle, cublas_fill_mode(uplo), n, A, n, work, lwork, info));
Expand All @@ -129,7 +129,7 @@ void potrf (cusolverDnHandle_t& cusolver_handle, const char& uplo, const int& n,
int *info = nullptr;
CHECK_CUDA(cudaMalloc((void**)&info, 1 * sizeof(int)));
CHECK_CUSOLVER(cusolverDnCpotrf_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuComplex*>(A), lda, &lwork));
cuComplex* work;
cuComplex* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(cuComplex)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnCpotrf(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuComplex*>(A), lda, work, lwork, info));
Expand All @@ -143,7 +143,7 @@ void potrf (cusolverDnHandle_t& cusolver_handle, const char& uplo, const int& n,
int *info = nullptr;
CHECK_CUDA(cudaMalloc((void**)&info, 1 * sizeof(int)));
CHECK_CUSOLVER(cusolverDnZpotrf_bufferSize(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuDoubleComplex*>(A), lda, &lwork));
cuDoubleComplex* work;
cuDoubleComplex* work = nullptr;
CHECK_CUDA(cudaMalloc((void**)&work, lwork * sizeof(cuDoubleComplex)));
// Perform Cholesky decomposition
CHECK_CUSOLVER(cusolverDnZpotrf(cusolver_handle, cublas_fill_mode(uplo), n, reinterpret_cast<cuDoubleComplex*>(A), lda, work, lwork, info));
Expand Down
16 changes: 8 additions & 8 deletions source/source_base/module_container/base/third_party/hipsolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void potri (hipsolverHandle_t& hipsolver_handle, const char& uplo, const char& d
{
int lwork;
hipsolverErrcheck(hipsolverDnSpotri_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, &lwork));
float* work;
float* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(float)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnSpotri(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, work, lwork, nullptr));
Expand All @@ -54,7 +54,7 @@ void potri (hipsolverHandle_t& hipsolver_handle, const char& uplo, const char& d
{
int lwork;
hipsolverErrcheck(hipsolverDnDpotri_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, &lwork));
double* work;
double* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(double)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnDpotri(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, work, lwork, nullptr));
Expand All @@ -65,7 +65,7 @@ void potri (hipsolverHandle_t& hipsolver_handle, const char& uplo, const char& d
{
int lwork;
hipsolverErrcheck(hipsolverDnCpotri_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipFloatComplex *>(A), n, &lwork));
hipFloatComplex* work;
hipFloatComplex* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(hipFloatComplex)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnCpotri(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipFloatComplex *>(A), n, work, lwork, nullptr));
Expand All @@ -76,7 +76,7 @@ void potri (hipsolverHandle_t& hipsolver_handle, const char& uplo, const char& d
{
int lwork;
hipsolverErrcheck(hipsolverDnZpotri_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipDoubleComplex *>(A), n, &lwork));
hipDoubleComplex* work;
hipDoubleComplex* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(hipDoubleComplex)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnZpotri(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipDoubleComplex *>(A), n, work, lwork, nullptr));
Expand All @@ -89,7 +89,7 @@ void potrf (hipsolverHandle_t& hipsolver_handle, const char& uplo, const int& n,
{
int lwork;
hipsolverErrcheck(hipsolverDnSpotrf_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, &lwork));
float* work;
float* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(float)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnSpotrf(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, work, lwork, nullptr));
Expand All @@ -100,7 +100,7 @@ void potrf (hipsolverHandle_t& hipsolver_handle, const char& uplo, const int& n,
{
int lwork;
hipsolverErrcheck(hipsolverDnDpotrf_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, &lwork));
double* work;
double* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(double)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnDpotrf(hipsolver_handle, hipsolver_fill_mode(uplo), n, A, n, work, lwork, nullptr));
Expand All @@ -111,7 +111,7 @@ void potrf (hipsolverHandle_t& hipsolver_handle, const char& uplo, const int& n,
{
int lwork;
hipsolverErrcheck(hipsolverDnCpotrf_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipFloatComplex*>(A), n, &lwork));
hipFloatComplex* work;
hipFloatComplex* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(hipFloatComplex)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnCpotrf(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipFloatComplex*>(A), n, work, lwork, nullptr));
Expand All @@ -122,7 +122,7 @@ void potrf (hipsolverHandle_t& hipsolver_handle, const char& uplo, const int& n,
{
int lwork;
hipsolverErrcheck(hipsolverDnZpotrf_bufferSize(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipDoubleComplex*>(A), n, &lwork));
hipDoubleComplex* work;
hipDoubleComplex* work = nullptr;
hipErrcheck(hipMalloc((void**)&work, lwork * sizeof(hipDoubleComplex)));
// Perform Cholesky decomposition
hipsolverErrcheck(hipsolverDnZpotrf(hipsolver_handle, hipsolver_fill_mode(uplo), n, reinterpret_cast<hipDoubleComplex*>(A), n, work, lwork, nullptr));
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/module_container/base/utils/array_ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ template <typename T>
class array_ref final {

private:
T* data_;
T* data_ = nullptr;
size_t length_;

public:
Expand Down
4 changes: 2 additions & 2 deletions source/source_base/module_fft/fft_dsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ void FFT_DSP<double>::setupFFT()
{
PROBLEM pbm_forward;
PROBLEM pbm_backward;
PLAN* ptr_plan_forward;
PLAN* ptr_plan_backward;
PLAN* ptr_plan_forward = nullptr;
PLAN* ptr_plan_backward = nullptr;
INT num_thread = 8;
INT size=0;
hthread_dat_load(cluster_id, FFT_DAT_DIR);
Expand Down
2 changes: 1 addition & 1 deletion source/source_base/realarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace ModuleBase
class realArray
{
public:
double *ptr;
double * ptr = nullptr;

realArray(const int d1 = 1, const int d2 = 1, const int d3 = 1);
realArray(const int d1, const int d2, const int d3, const int d4);
Expand Down
10 changes: 5 additions & 5 deletions source/source_basis/module_ao/ORB_nonlocal_lm.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class Numerical_Nonlocal_Lm

public:

double* beta_uniform;
double* dbeta_uniform;
double* beta_uniform = nullptr;
double* dbeta_uniform = nullptr;
int nr_uniform;
double dr_uniform;

Expand Down Expand Up @@ -86,11 +86,11 @@ class Numerical_Nonlocal_Lm
double dk;

double* r_radial; //points of r
double* k_radial;
double* k_radial = nullptr;

double* rab;
double* rab = nullptr;
double* beta_r; // |beta(r) * r>
double* beta_k;
double* beta_k = nullptr;
};

#endif
4 changes: 2 additions & 2 deletions source/source_basis/module_ao/ORB_read.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class LCAO_Orbitals
std::vector<double> cutoffs() const;

/// numerical atomic orbitals
Numerical_Orbital* Phi;
Numerical_Orbital* Phi = nullptr;


//caoyu add 2021-3-10
/// descriptor bases, saved as one-type atom orbital
Numerical_Orbital* Alpha;
Numerical_Orbital* Alpha = nullptr;

// initialized in input.cpp
double ecutwfc;
Expand Down
6 changes: 3 additions & 3 deletions source/source_basis/module_ao/parallel_orbitals.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class Parallel_Orbitals : public Parallel_2D
/// on all adjacent atoms-pairs(2D division)
///---------------------------------------
int nnr=1;
int *nlocdim;
int *nlocstart;
int * nlocdim = nullptr;
int * nlocstart = nullptr;

#ifdef __MPI
int desc_wfc[9]; //for wfc, nlocal*nbands
Expand All @@ -49,7 +49,7 @@ class Parallel_Orbitals : public Parallel_2D
const int& lld);
#endif

int* loc_sizes;
int* loc_sizes = nullptr;
int loc_size;

int get_wfc_global_nbands () const;
Expand Down
10 changes: 5 additions & 5 deletions source/source_basis/module_pw/pw_transform_k_dsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ void PW_Basis_K::real2recip_dsp(const std::complex<double>* in,
const bool add,
const double factor) const
{
const base_device::DEVICE_CPU* ctx;
const base_device::DEVICE_GPU* gpux;
const base_device::DEVICE_CPU* ctx = nullptr;
const base_device::DEVICE_GPU* gpux = nullptr;
assert(this->gamma_only == false);
auto* auxr = this->fft_bundle.get_auxr_3d_data<double>();

Expand Down Expand Up @@ -65,8 +65,8 @@ void PW_Basis_K::recip2real_dsp(const std::complex<double>* in,
const double factor) const
{
assert(this->gamma_only == false);
const base_device::DEVICE_CPU* ctx;
const base_device::DEVICE_GPU* gpux;
const base_device::DEVICE_CPU* ctx = nullptr;
const base_device::DEVICE_GPU* gpux = nullptr;
// memset the auxr of 0 in the auxr,here the len of the auxr is nxyz
auto* auxr = this->fft_bundle.get_auxr_3d_data<double>();
memset(auxr, 0, this->nxyz * 2 * 8);
Expand Down Expand Up @@ -115,7 +115,7 @@ void PW_Basis_K::convolution(const base_device::DEVICE_CPU* ctx,
ModuleBase::timer::tick(this->classname, "convolution");

assert(this->gamma_only == false);
const base_device::DEVICE_GPU* gpux;
const base_device::DEVICE_GPU* gpux = nullptr;
// memset the auxr of 0 in the auxr,here the len of the auxr is nxyz
auto* auxr = this->fft_bundle.get_auxr_3d_data<double>();
memset(auxr, 0, this->nxyz * 2 * 8);
Expand Down
Loading
Loading