forked from lijiext/lammps
reverse logic for using MKL pRNG: this way, make serial and make mpi will compile LAMMPS with USER-INTEL installed
This commit is contained in:
parent
cf24dd0265
commit
2a24cbfe0c
|
@ -10,7 +10,7 @@ CC = mpiicpc
|
|||
MIC_OPT = -qoffload-option,mic,compiler,"-fp-model fast=2 -mGLOB_default_function_attrs=\"gather_scatter_loop_unroll=4\""
|
||||
CCFLAGS = -g -O3 -qopenmp -DLMP_INTEL_OFFLOAD -DLAMMPS_MEMALIGN=64 \
|
||||
-xHost -fno-alias -ansi-alias -restrict -DLMP_INTEL_USELRT \
|
||||
-qoverride-limits $(MIC_OPT)
|
||||
-qoverride-limits $(MIC_OPT) -DLMP_USE_MKL_RNG
|
||||
SHFLAGS = -fPIC
|
||||
DEPFLAGS = -M
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ SHELL = /bin/sh
|
|||
CC = mpiicpc
|
||||
OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits
|
||||
CCFLAGS = -g -qopenmp -DLAMMPS_MEMALIGN=64 -no-offload \
|
||||
-fno-alias -ansi-alias -restrict $(OPTFLAGS)
|
||||
-fno-alias -ansi-alias -restrict $(OPTFLAGS) \
|
||||
-DLMP_USE_MKL_RNG
|
||||
SHFLAGS = -fPIC
|
||||
DEPFLAGS = -M
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ SHELL = /bin/sh
|
|||
CC = mpiicpc
|
||||
OPTFLAGS = -xHost -O2 -fp-model fast=2 -no-prec-div -qoverride-limits
|
||||
CCFLAGS = -qopenmp -DLAMMPS_MEMALIGN=64 -qno-offload \
|
||||
-fno-alias -ansi-alias -restrict $(OPTFLAGS) -DLMP_INTEL_USELRT
|
||||
-fno-alias -ansi-alias -restrict $(OPTFLAGS) \
|
||||
-DLMP_USE_MKL_RNG -DLMP_INTEL_USELRT
|
||||
SHFLAGS = -fPIC
|
||||
DEPFLAGS = -M
|
||||
|
||||
|
|
|
@ -9,8 +9,10 @@ SHELL = /bin/sh
|
|||
CC = mpiicpc
|
||||
MIC_OPT = -qoffload-arch=mic-avx512 -fp-model fast=2
|
||||
CCFLAGS = -O3 -qopenmp -DLMP_INTEL_OFFLOAD -DLAMMPS_MEMALIGN=64 \
|
||||
-xHost -fno-alias -ansi-alias -restrict \
|
||||
-qoverride-limits $(MIC_OPT) -DLMP_INTEL_USELRT
|
||||
-xHost -fno-alias -ansi-alias -restrict \
|
||||
-qoverride-limits $(MIC_OPT) -DLMP_INTEL_USELRT \
|
||||
-DLMP_USE_MKL_RNG
|
||||
|
||||
SHFLAGS = -fPIC
|
||||
DEPFLAGS = -M
|
||||
|
||||
|
|
|
@ -47,12 +47,12 @@ PairDPDIntel::~PairDPDIntel()
|
|||
{
|
||||
#if defined(_OPENMP)
|
||||
if (_nrandom_thread) {
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
for (int i = 1; i < _nrandom_thread; i++)
|
||||
delete random_thread[i];
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
for (int i = 0; i < _nrandom_thread; i++)
|
||||
vslDeleteStream(&random_thread[i]);
|
||||
#else
|
||||
for (int i = 1; i < _nrandom_thread; i++)
|
||||
delete random_thread[i];
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -216,10 +216,10 @@ void PairDPDIntel::eval(const int offload, const int vflag,
|
|||
iifrom += astart;
|
||||
iito += astart;
|
||||
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
RanMars *my_random = random_thread[tid];
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
VSLStreamStatePtr *my_random = &(random_thread[tid]);
|
||||
#else
|
||||
RanMars *my_random = random_thread[tid];
|
||||
#endif
|
||||
flt_t *my_rand_buffer = fc.rand_buffer_thread[tid];
|
||||
int rngi = rngi_thread[tid];
|
||||
|
@ -264,16 +264,16 @@ void PairDPDIntel::eval(const int offload, const int vflag,
|
|||
if (vflag==1) sv0 = sv1 = sv2 = sv3 = sv4 = sv5 = (acc_t)0;
|
||||
|
||||
if (rngi + jnum > rng_size) {
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
for (int jj = 0; jj < rngi; jj++)
|
||||
my_rand_buffer[jj] = my_random->gaussian();
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
if (sizeof(flt_t) == sizeof(float))
|
||||
vsRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF, *my_random, rngi,
|
||||
(float*)my_rand_buffer, (float)0.0, (float)1.0 );
|
||||
else
|
||||
vdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_ICDF, *my_random, rngi,
|
||||
(double*)my_rand_buffer, 0.0, 1.0 );
|
||||
#else
|
||||
for (int jj = 0; jj < rngi; jj++)
|
||||
my_rand_buffer[jj] = my_random->gaussian();
|
||||
#endif
|
||||
rngi = 0;
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ void PairDPDIntel::eval(const int offload, const int vflag,
|
|||
void PairDPDIntel::settings(int narg, char **arg) {
|
||||
#if defined(_OPENMP)
|
||||
if (_nrandom_thread) {
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
for (int i = 1; i < _nrandom_thread; i++)
|
||||
delete random_thread[i];
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
for (int i = 0; i < _nrandom_thread; i++)
|
||||
vslDeleteStream(&random_thread[i]);
|
||||
#else
|
||||
for (int i = 1; i < _nrandom_thread; i++)
|
||||
delete random_thread[i];
|
||||
#endif
|
||||
}
|
||||
delete []random_thread;
|
||||
|
@ -433,7 +433,19 @@ void PairDPDIntel::settings(int narg, char **arg) {
|
|||
PairDPD::settings(narg,arg);
|
||||
_nrandom_thread = comm->nthreads;
|
||||
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
|
||||
random_thread=new VSLStreamStatePtr[comm->nthreads];
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
vslNewStream(&random_thread[tid], LMP_MKL_RNG,
|
||||
seed + comm->me + comm->nprocs * tid );
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
random_thread =new RanMars*[comm->nthreads];
|
||||
random_thread[0] = random;
|
||||
|
@ -446,18 +458,6 @@ void PairDPDIntel::settings(int narg, char **arg) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
random_thread=new VSLStreamStatePtr[comm->nthreads];
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
vslNewStream(&random_thread[tid], LMP_MKL_RNG,
|
||||
seed + comm->me + comm->nprocs * tid );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -575,12 +575,12 @@ void PairDPDIntel::read_restart_settings(FILE *fp)
|
|||
{
|
||||
#if defined(_OPENMP)
|
||||
if (_nrandom_thread) {
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
for (int i = 1; i < _nrandom_thread; i++)
|
||||
delete random_thread[i];
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
for (int i = 0; i < _nrandom_thread; i++)
|
||||
vslDeleteStream(&random_thread[i]);
|
||||
#else
|
||||
for (int i = 1; i < _nrandom_thread; i++)
|
||||
delete random_thread[i];
|
||||
#endif
|
||||
}
|
||||
delete []random_thread;
|
||||
|
@ -588,7 +588,19 @@ void PairDPDIntel::read_restart_settings(FILE *fp)
|
|||
PairDPD::read_restart_settings(fp);
|
||||
_nrandom_thread = comm->nthreads;
|
||||
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
|
||||
random_thread=new VSLStreamStatePtr[comm->nthreads];
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
vslNewStream(&random_thread[tid], LMP_MKL_RNG,
|
||||
seed + comm->me + comm->nprocs * tid );
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
random_thread =new RanMars*[comm->nthreads];
|
||||
random_thread[0] = random;
|
||||
|
@ -601,17 +613,5 @@ void PairDPDIntel::read_restart_settings(FILE *fp)
|
|||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
random_thread=new VSLStreamStatePtr[comm->nthreads];
|
||||
#if defined(_OPENMP)
|
||||
#pragma omp parallel
|
||||
{
|
||||
int tid = omp_get_thread_num();
|
||||
vslNewStream(&random_thread[tid], LMP_MKL_RNG,
|
||||
seed + comm->me + comm->nprocs * tid );
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ PairStyle(dpd/intel,PairDPDIntel)
|
|||
#include "pair_dpd.h"
|
||||
#include "fix_intel.h"
|
||||
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
#include "random_mars.h"
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
#include "mkl_vsl.h"
|
||||
#else
|
||||
#include "random_mars.h"
|
||||
#endif
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
@ -46,15 +46,15 @@ class PairDPDIntel : public PairDPD {
|
|||
void settings(int, char **);
|
||||
void init_style();
|
||||
void read_restart_settings(FILE *);
|
||||
|
||||
|
||||
private:
|
||||
FixIntel *fix;
|
||||
int _cop, _onetype, _nrandom_thread;
|
||||
|
||||
#ifdef LMP_NO_MKL_RNG
|
||||
RanMars **random_thread;
|
||||
#else
|
||||
#ifdef LMP_USE_MKL_RNG
|
||||
VSLStreamStatePtr *random_thread;
|
||||
#else
|
||||
RanMars **random_thread;
|
||||
#endif
|
||||
|
||||
template <class flt_t> class ForceConst;
|
||||
|
@ -86,7 +86,7 @@ class PairDPDIntel : public PairDPD {
|
|||
~ForceConst() { set_ntypes(0, 0, 0, NULL, _cop); }
|
||||
|
||||
void set_ntypes(const int ntypes, const int nthreads, const int max_nbors,
|
||||
Memory *memory, const int cop);
|
||||
Memory *memory, const int cop);
|
||||
|
||||
private:
|
||||
int _ntypes, _cop;
|
||||
|
|
Loading…
Reference in New Issue