git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11631 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -44,7 +44,7 @@ DumpAtomMPIIO::DumpAtomMPIIO(LAMMPS *lmp, int narg, char **arg) :
|
||||
|
||||
DumpAtomMPIIO::~DumpAtomMPIIO()
|
||||
{
|
||||
if (multifile == 0) MPI_File_close(&mpifh);
|
||||
if (multifile == 0) MPI_File_close(&mpifh);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -82,8 +82,11 @@ void DumpAtomMPIIO::openfile()
|
||||
|
||||
if (append_flag) { // append open
|
||||
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
|
||||
if (err != MPI_SUCCESS)
|
||||
error->one(FLERR,"Cannot open dump file");
|
||||
if (err != MPI_SUCCESS) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open dump file %s",filecurrent);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
int myrank;
|
||||
MPI_Comm_rank(world,&myrank);
|
||||
if (myrank == 0)
|
||||
@ -96,8 +99,11 @@ void DumpAtomMPIIO::openfile()
|
||||
else { // replace open
|
||||
|
||||
int err = MPI_File_open( world, filecurrent, MPI_MODE_CREATE | MPI_MODE_APPEND | MPI_MODE_WRONLY , MPI_INFO_NULL, &mpifh);
|
||||
if (err != MPI_SUCCESS)
|
||||
error->one(FLERR,"Cannot open dump file");
|
||||
if (err != MPI_SUCCESS) {
|
||||
char str[128];
|
||||
sprintf(str,"Cannot open dump file %s",filecurrent);
|
||||
error->one(FLERR,str);
|
||||
}
|
||||
mpifo = 0;
|
||||
|
||||
MPI_File_set_size(mpifh,(MPI_Offset) (headerSize+sumFileSize));
|
||||
@ -546,7 +552,7 @@ int DumpAtomMPIIO::convert_string_omp(int n, double *mybuf)
|
||||
|
||||
int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
|
||||
{
|
||||
double *localbuf = mybuf;
|
||||
MPI_Status mpiStatus;
|
||||
char **mpifh_buffer_line_per_thread;
|
||||
int mpifhStringCount;
|
||||
int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength;
|
||||
@ -581,7 +587,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
|
||||
mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char));
|
||||
mpifh_buffer_line_per_thread[i][0] = '\0';
|
||||
|
||||
#pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread)
|
||||
#pragma omp parallel default(none) shared(bufOffset, bufRange, bufLength, mpifhStringCountPerThread, mpifh_buffer_line_per_thread, mybuf)
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
int m=0;
|
||||
@ -593,7 +599,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
|
||||
bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char);
|
||||
}
|
||||
|
||||
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (localbuf[bufOffset[tid]+m]),static_cast<int> (localbuf[bufOffset[tid]+m+1]),localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4],static_cast<int> (localbuf[bufOffset[tid]+m+5]),static_cast<int> (localbuf[bufOffset[tid]+m+6]),static_cast<int> (localbuf[bufOffset[tid]+m+7]));
|
||||
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (mybuf[bufOffset[tid]+m]),static_cast<int> (mybuf[bufOffset[tid]+m+1]),mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4],static_cast<int> (mybuf[bufOffset[tid]+m+5]),static_cast<int> (mybuf[bufOffset[tid]+m+6]),static_cast<int> (mybuf[bufOffset[tid]+m+7]));
|
||||
m += size_one;
|
||||
}
|
||||
}
|
||||
@ -637,7 +643,7 @@ int DumpAtomMPIIO::convert_image_omp(int n, double *mybuf)
|
||||
|
||||
int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf)
|
||||
{
|
||||
double *localbuf = mybuf;
|
||||
MPI_Status mpiStatus;
|
||||
char **mpifh_buffer_line_per_thread;
|
||||
int mpifhStringCount;
|
||||
int *mpifhStringCountPerThread, *bufOffset, *bufRange, *bufLength;
|
||||
@ -672,7 +678,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf)
|
||||
mpifh_buffer_line_per_thread[i] = (char *) malloc(DUMP_BUF_CHUNK_SIZE * sizeof(char));
|
||||
mpifh_buffer_line_per_thread[i][0] = '\0';
|
||||
|
||||
#pragma omp parallel default(none) shared(localbuf,bufLength,bufOffset,bufRange,mpifhStringCountPerThread,mpifh_buffer_line_per_thread)
|
||||
#pragma omp parallel default(none) shared(bufOffset, bufRange, bufLength, mpifhStringCountPerThread, mpifh_buffer_line_per_thread, mybuf)
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
int m=0;
|
||||
@ -684,7 +690,7 @@ int DumpAtomMPIIO::convert_noimage_omp(int n, double *mybuf)
|
||||
bufLength[tid] = (mpifhStringCountPerThread[tid]+DUMP_BUF_CHUNK_SIZE) * sizeof(char);
|
||||
}
|
||||
|
||||
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (localbuf[bufOffset[tid]+m]),static_cast<int> (localbuf[bufOffset[tid]+m+1]),localbuf[bufOffset[tid]+m+2],localbuf[bufOffset[tid]+m+3],localbuf[bufOffset[tid]+m+4]);
|
||||
mpifhStringCountPerThread[tid] += sprintf(&(mpifh_buffer_line_per_thread[tid][mpifhStringCountPerThread[tid]]),format,static_cast<int> (mybuf[bufOffset[tid]+m]),static_cast<int> (mybuf[bufOffset[tid]+m+1]),mybuf[bufOffset[tid]+m+2],mybuf[bufOffset[tid]+m+3],mybuf[bufOffset[tid]+m+4]);
|
||||
m += size_one;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user