#include "SortAtoms.h"
#include "NamdTypes.h"
#include <algorithm>
#include "CudaUtils.h"
Go to the source code of this file.
|
#define | NTH_ELEMENT(BEGIN, SPLIT, END, OP) std::nth_element(BEGIN,SPLIT,END,OP) |
|
|
static void | partition (int *order, const FullAtom *atoms, int begin, int end) |
|
void | sortAtomsForCUDA (int *order, const FullAtom *atoms, int nfree, int n) |
|
void | sortAtomsForPatches (int *order, int *breaks, const FullAtom *atoms, int nmgrps, int natoms, int ni, int nj, int nk) |
|
#define NTH_ELEMENT |
( |
|
BEGIN, |
|
|
|
SPLIT, |
|
|
|
END, |
|
|
|
OP |
|
) |
| std::nth_element(BEGIN,SPLIT,END,OP) |
static void partition |
( |
int * |
order, |
|
|
const FullAtom * |
atoms, |
|
|
int |
begin, |
|
|
int |
end |
|
) |
| |
|
static |
Definition at line 42 of file SortAtoms.C.
References NTH_ELEMENT, CompAtom::position, split(), WARPSIZE, Vector::x, Vector::y, and Vector::z.
Referenced by Sequencer::calcKineticEnergy(), HomePatch::hardWallDrude(), Sequencer::langevinVelocities(), Sequencer::langevinVelocitiesBBK2(), Sequencer::multigratorPressure(), HomePatch::rattle1old(), Sequencer::reassignVelocities(), Sequencer::reinitVelocities(), sortAtomsForCUDA(), Sequencer::submitHalfstep(), and Sequencer::submitReductions().
63 BigReal xmin, ymin, zmin, xmax, ymax, zmax;
73 for (
int i=begin+1; i<end; ++i ) {
75 if ( pos.
x < xmin ) { xmin = pos.
x; }
76 if ( pos.
y < ymin ) { ymin = pos.
y; }
77 if ( pos.
z < zmin ) { zmin = pos.
z; }
78 if ( pos.
x > xmax ) { xmax = pos.
x; }
79 if ( pos.
y > ymax ) { ymax = pos.
y; }
80 if ( pos.
z > zmax ) { zmax = pos.
z; }
86 #define NTH_ELEMENT(BEGIN,SPLIT,END,OP) std::nth_element(BEGIN,SPLIT,END,OP)
87 #if (defined(NAMD_CUDA) || defined(NAMD_HIP)) && defined(__GNUC_PATCHLEVEL__)
88 #if __GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ == 2
89 #define NTH_ELEMENT(BEGIN,SPLIT,END,OP) std::sort(BEGIN,END,OP)
90 #warning gcc 4.8.2 std::nth_element would segfault (see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800)
94 if ( xmax >= ymax && xmax >= zmax ) {
96 }
else if ( ymax >= xmax && ymax >= zmax ) {
static void partition(int *order, const FullAtom *atoms, int begin, int end)
#define NTH_ELEMENT(BEGIN, SPLIT, END, OP)
std::vector< std::string > split(const std::string &text, std::string delimiter)
void sortAtomsForCUDA |
( |
int * |
order, |
|
|
const FullAtom * |
atoms, |
|
|
int |
nfree, |
|
|
int |
n |
|
) |
| |
void sortAtomsForPatches |
( |
int * |
order, |
|
|
int * |
breaks, |
|
|
const FullAtom * |
atoms, |
|
|
int |
nmgrps, |
|
|
int |
natoms, |
|
|
int |
ni, |
|
|
int |
nj, |
|
|
int |
nk |
|
) |
| |
Definition at line 129 of file SortAtoms.C.
References FullAtom::migrationGroupSize, and sort.
Referenced by WorkDistrib::createAtomLists().
139 for (
int ip=0; ip < ni; ++ip ) {
141 int targi = nai + (natoms - nai - 1) / (ni - ip) + 1;
143 for ( iend=ibegin; iend<nmgrps; ++iend ) {
145 if (nai + mgs <= targi) nai += mgs;
151 for (
int jp=0; jp < nj; ++jp ) {
153 int targj = naj + (nai - naj - 1) / (nj - jp) + 1;
155 for ( jend=jbegin; jend<iend; ++jend ) {
157 if (naj + mgs <= targj) naj += mgs;
164 for (
int kp=0; kp < nk; ++kp ) {
165 int targk = nak + (naj - nak - 1) / (nk - kp) + 1;
167 for ( kend=kbegin; kend<jend; ++kend ) {
169 if (nak + mgs <= targk) nak += mgs;
175 breaks[pid++] = kend;
BlockRadixSort::TempStorage sort