use auto type when assigning from cast or using new
This commit is contained in:
31
src/comm.cpp
31
src/comm.cpp
@ -550,7 +550,7 @@ void Comm::set_proc_grid(int outflag)
|
||||
|
||||
// create ProcMap class to create 3d grid and map procs to it
|
||||
|
||||
ProcMap *pmap = new ProcMap(lmp);
|
||||
auto pmap = new ProcMap(lmp);
|
||||
|
||||
// create 3d grid of processors
|
||||
// produces procgrid and coregrid (if relevant)
|
||||
@ -1011,7 +1011,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
{
|
||||
// irregular comm of inbuf from caller decomp to rendezvous decomp
|
||||
|
||||
Irregular *irregular = new Irregular(lmp);
|
||||
auto irregular = new Irregular(lmp);
|
||||
|
||||
int nrvous;
|
||||
if (inorder) nrvous = irregular->create_data_grouped(n,procs);
|
||||
@ -1019,8 +1019,7 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
|
||||
// add 1 item to the allocated buffer size, so the returned pointer is not a null pointer
|
||||
|
||||
char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1,
|
||||
"rendezvous:inbuf");
|
||||
auto inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf");
|
||||
irregular->exchange_data(inbuf,insize,inbuf_rvous);
|
||||
|
||||
bigint irregular1_bytes = irregular->memory_usage();
|
||||
@ -1033,14 +1032,12 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
int flag;
|
||||
int *procs_rvous;
|
||||
char *outbuf_rvous;
|
||||
int nrvous_out = callback(nrvous,inbuf_rvous,flag,
|
||||
procs_rvous,outbuf_rvous,ptr);
|
||||
int nrvous_out = callback(nrvous,inbuf_rvous,flag, procs_rvous,outbuf_rvous,ptr);
|
||||
|
||||
if (flag != 1) memory->sfree(inbuf_rvous); // outbuf_rvous = inbuf_vous
|
||||
if (flag == 0) {
|
||||
if (statflag) rendezvous_stats(n,0,nrvous,nrvous_out,insize,outsize,
|
||||
(bigint) nrvous_out*sizeof(int) +
|
||||
irregular1_bytes);
|
||||
(bigint) nrvous_out*sizeof(int) + irregular1_bytes);
|
||||
return 0; // all nout_rvous are 0, no 2nd comm stage
|
||||
}
|
||||
|
||||
@ -1050,14 +1047,12 @@ rendezvous_irregular(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
irregular = new Irregular(lmp);
|
||||
|
||||
int nout;
|
||||
if (outorder)
|
||||
nout = irregular->create_data_grouped(nrvous_out,procs_rvous);
|
||||
if (outorder) nout = irregular->create_data_grouped(nrvous_out,procs_rvous);
|
||||
else nout = irregular->create_data(nrvous_out,procs_rvous);
|
||||
|
||||
// add 1 item to the allocated buffer size, so the returned pointer is not a null pointer
|
||||
|
||||
outbuf = (char *) memory->smalloc((bigint) nout*outsize+1,
|
||||
"rendezvous:outbuf");
|
||||
outbuf = (char *) memory->smalloc((bigint) nout*outsize+1, "rendezvous:outbuf");
|
||||
irregular->exchange_data(outbuf_rvous,outsize,outbuf);
|
||||
|
||||
bigint irregular2_bytes = irregular->memory_usage();
|
||||
@ -1164,8 +1159,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
// all2all comm of inbuf from caller decomp to rendezvous decomp
|
||||
// add 1 item to the allocated buffer size, so the returned pointer is not a null pointer
|
||||
|
||||
char *inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1,
|
||||
"rendezvous:inbuf");
|
||||
auto inbuf_rvous = (char *) memory->smalloc((bigint) nrvous*insize+1, "rendezvous:inbuf");
|
||||
memset(inbuf_rvous,0,(bigint) nrvous*insize*sizeof(char));
|
||||
|
||||
MPI_Alltoallv(inbuf_a2a,sendcount,sdispls,MPI_CHAR,
|
||||
@ -1184,8 +1178,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
int *procs_rvous;
|
||||
char *outbuf_rvous;
|
||||
|
||||
int nrvous_out = callback(nrvous,inbuf_rvous,flag,
|
||||
procs_rvous,outbuf_rvous,ptr);
|
||||
int nrvous_out = callback(nrvous,inbuf_rvous,flag, procs_rvous,outbuf_rvous,ptr);
|
||||
|
||||
if (flag != 1) memory->sfree(inbuf_rvous); // outbuf_rvous = inbuf_vous
|
||||
if (flag == 0) {
|
||||
@ -1206,8 +1199,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
|
||||
// add 1 item to the allocated buffer size, so the returned pointer is not a null pointer
|
||||
|
||||
outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1,
|
||||
"rendezvous:outbuf");
|
||||
outbuf_a2a = (char *) memory->smalloc((bigint) nrvous_out*outsize+1, "rendezvous:outbuf");
|
||||
memory->create(offsets,nprocs,"rendezvous:offsets");
|
||||
|
||||
for (int i = 0; i < nprocs; i++) procs_a2a[i] = 0;
|
||||
@ -1225,8 +1217,7 @@ rendezvous_all2all(int n, char *inbuf, int insize, int inorder, int *procs,
|
||||
offset += outsize;
|
||||
}
|
||||
|
||||
all2all2_bytes = nprocs*sizeof(int) + nprocs*sizeof(bigint) +
|
||||
(bigint)nrvous_out*outsize;
|
||||
all2all2_bytes = nprocs*sizeof(int) + nprocs*sizeof(bigint) + (bigint)nrvous_out*outsize;
|
||||
|
||||
} else {
|
||||
procs_a2a = procs_rvous;
|
||||
|
||||
Reference in New Issue
Block a user