This commit is contained in:
Axel Kohlmeyer
2024-03-19 12:04:06 -04:00
parent f8da51828a
commit d0e2a846b2

View File

@ -2864,8 +2864,7 @@ void lammps_gather_atoms_concat(void *handle, const char *name, int type,
displs[0] = 0; displs[0] = 0;
for (i = 1; i < nprocs; i++) for (i = 1; i < nprocs; i++)
displs[i] = displs[i-1] + recvcounts[i-1]; displs[i] = displs[i-1] + recvcounts[i-1];
MPI_Allgatherv(vector,nlocal,MPI_INT,data,recvcounts,displs, MPI_Allgatherv(vector,nlocal,MPI_INT,data,recvcounts,displs,MPI_INT,lmp->world);
MPI_INT,lmp->world);
} else if (imgunpack) { } else if (imgunpack) {
int *copy; int *copy;
@ -2884,8 +2883,7 @@ void lammps_gather_atoms_concat(void *handle, const char *name, int type,
displs[0] = 0; displs[0] = 0;
for (i = 1; i < nprocs; i++) for (i = 1; i < nprocs; i++)
displs[i] = displs[i-1] + recvcounts[i-1]; displs[i] = displs[i-1] + recvcounts[i-1];
MPI_Allgatherv(copy,count*nlocal,MPI_INT, MPI_Allgatherv(copy,count*nlocal,MPI_INT,data,recvcounts,displs,MPI_INT,lmp->world);
data,recvcounts,displs,MPI_INT,lmp->world);
lmp->memory->destroy(copy); lmp->memory->destroy(copy);
} else { } else {
@ -2894,8 +2892,7 @@ void lammps_gather_atoms_concat(void *handle, const char *name, int type,
displs[0] = 0; displs[0] = 0;
for (i = 1; i < nprocs; i++) for (i = 1; i < nprocs; i++)
displs[i] = displs[i-1] + recvcounts[i-1]; displs[i] = displs[i-1] + recvcounts[i-1];
MPI_Allgatherv(&array[0][0],count*nlocal,MPI_INT, MPI_Allgatherv(&array[0][0],count*nlocal,MPI_INT,data,recvcounts,displs,MPI_INT,lmp->world);
data,recvcounts,displs,MPI_INT,lmp->world);
} }
} else { } else {
@ -2911,8 +2908,7 @@ void lammps_gather_atoms_concat(void *handle, const char *name, int type,
displs[0] = 0; displs[0] = 0;
for (i = 1; i < nprocs; i++) for (i = 1; i < nprocs; i++)
displs[i] = displs[i-1] + recvcounts[i-1]; displs[i] = displs[i-1] + recvcounts[i-1];
MPI_Allgatherv(vector,nlocal,MPI_DOUBLE,data,recvcounts,displs, MPI_Allgatherv(vector,nlocal,MPI_DOUBLE,data,recvcounts,displs,MPI_DOUBLE,lmp->world);
MPI_DOUBLE,lmp->world);
} else { } else {
int n = count*nlocal; int n = count*nlocal;
@ -3170,10 +3166,6 @@ void lammps_scatter_atoms(void *handle, const char *name, int type, int count,
return; return;
} }
// copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
if (type == 0) { if (type == 0) {
int *vector = nullptr; int *vector = nullptr;
int **array = nullptr; int **array = nullptr;
@ -3321,10 +3313,6 @@ void lammps_scatter_atoms_subset(void *handle, const char *name, int type,
return; return;
} }
// copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
if (type == 0) { if (type == 0) {
int *vector = nullptr; int *vector = nullptr;
int **array = nullptr; int **array = nullptr;
@ -4354,8 +4342,7 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
displs[0] = 0; displs[0] = 0;
for (i = 1; i < nprocs; i++) for (i = 1; i < nprocs; i++)
displs[i] = displs[i-1] + recvcounts[i-1]; displs[i] = displs[i-1] + recvcounts[i-1];
MPI_Allgatherv(copy,count*nlocal,MPI_INT, MPI_Allgatherv(copy,count*nlocal,MPI_INT,data,recvcounts,displs,MPI_INT,lmp->world);
data,recvcounts,displs,MPI_INT,lmp->world);
lmp->memory->destroy(copy); lmp->memory->destroy(copy);
} else { } else {
@ -4364,8 +4351,7 @@ void lammps_gather_concat(void *handle, const char *name, int type, int count,
displs[0] = 0; displs[0] = 0;
for (i = 1; i < nprocs; i++) for (i = 1; i < nprocs; i++)
displs[i] = displs[i-1] + recvcounts[i-1]; displs[i] = displs[i-1] + recvcounts[i-1];
MPI_Allgatherv(&array[0][0],count*nlocal,MPI_INT, MPI_Allgatherv(&array[0][0],count*nlocal,MPI_INT,data,recvcounts,displs,MPI_INT,lmp->world);
data,recvcounts,displs,MPI_INT,lmp->world);
} }
} else { } else {
@ -4874,10 +4860,6 @@ void lammps_scatter(void *handle, const char *name, int type, int count,
return; return;
} }
// copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
if (type == 0) { if (type == 0) {
int *vector = nullptr; int *vector = nullptr;
int **array = nullptr; int **array = nullptr;
@ -5128,10 +5110,6 @@ void lammps_scatter_subset(void *handle, const char *name,int type, int count,
return; return;
} }
// copy = Natom length vector of per-atom values
// use atom ID to insert each atom's values into copy
// MPI_Allreduce with MPI_SUM to merge into data, ordered by atom ID
if (type == 0) { if (type == 0) {
int *vector = nullptr; int *vector = nullptr;
int **array = nullptr; int **array = nullptr;
@ -5488,7 +5466,8 @@ int lammps_neighlist_num_elements(void *handle, int idx) {
* \param[out] numneigh number of neighbors of atom iatom or 0 * \param[out] numneigh number of neighbors of atom iatom or 0
* \param[out] neighbors pointer to array of neighbor atom local indices or NULL */ * \param[out] neighbors pointer to array of neighbor atom local indices or NULL */
void lammps_neighlist_element_neighbors(void *handle, int idx, int element, int *iatom, int *numneigh, int **neighbors) { void lammps_neighlist_element_neighbors(void *handle, int idx, int element, int *iatom,
int *numneigh, int **neighbors) {
auto lmp = (LAMMPS *) handle; auto lmp = (LAMMPS *) handle;
Neighbor * neighbor = lmp->neighbor; Neighbor * neighbor = lmp->neighbor;
*iatom = -1; *iatom = -1;
@ -5775,9 +5754,7 @@ otherwise 0.
* \param setting string with the name of the specific setting * \param setting string with the name of the specific setting
* \return 1 if available, 0 if not. * \return 1 if available, 0 if not.
*/ */
int lammps_config_accelerator(const char *package, int lammps_config_accelerator(const char *package, const char *category, const char *setting)
const char *category,
const char *setting)
{ {
return Info::has_accelerator_feature(package,category,setting) ? 1 : 0; return Info::has_accelerator_feature(package,category,setting) ? 1 : 0;
} }
@ -5899,8 +5876,7 @@ int lammps_style_count(void *handle, const char *category) {
* \param buf_size size of the provided string buffer * \param buf_size size of the provided string buffer
* \return 1 if successful, otherwise 0 * \return 1 if successful, otherwise 0
*/ */
int lammps_style_name(void *handle, const char *category, int idx, int lammps_style_name(void *handle, const char *category, int idx, char *buffer, int buf_size) {
char *buffer, int buf_size) {
auto lmp = (LAMMPS *) handle; auto lmp = (LAMMPS *) handle;
Info info(lmp); Info info(lmp);
auto styles = info.get_available_styles(category); auto styles = info.get_available_styles(category);