Commit 7bad191c authored by Valeriy M Tenishev's avatar Valeriy M Tenishev
Browse files

Revert "Merge branch 'CUDA-DEV'"

This reverts commit c1f9c5ef
parent c1f9c5ef
......@@ -125,9 +125,6 @@ foreach (@Arguments) {
print "-cpplib-rm=opt\t\t\tremove libraty flag from the list defined by variable CPPLIB in Makefile.conf\n";
print "-avx=[256,512,off]\t\t\tsettings for using AVX instructions\n";
print "-mp=[on,off]\t\t\tallow memory prefetch\n";
print "-cuda\t\t\t\tcompile AMPS as a CUDA code\n";
print "-no-signals\t\t\tsupress interseption of the operating system signals\n";
print "-fexit=[exit,mpi_abort]\t\tselect function that will be used to terminate code in case of an error. In some systems mpi_abort() does not terminate the code, but in other systems exit() does not terminate the code\n";
exit;
}
......@@ -167,11 +164,6 @@ foreach (@Arguments) {
`cp -f input/$application.* input/species.input .`;
#set defailt compilation module flags in Makefile.local
`sed '/COMPILE_/d' Makefile.local > Makefile.local.new`;
`rm Makefile.local`;
`mv Makefile.local.new Makefile.local`;
#remove path from the name of the input file is such exists
my @list;
......@@ -236,24 +228,6 @@ foreach (@Arguments) {
}
}
if (/^-fexit=(.*)$/i) {
my $t;
$t=lc($1);
add_line_amps_conf("OPENMP=$1");
if ($t eq "exit") {
add_line_general_conf("#undef _GENERIC_EXIT_FUNCTION_MODE_ \n#define _GENERIC_EXIT_FUNCTION_MODE_ _GENERIC_EXIT_FUNCTION__EXIT_\n");
next;
}
elsif ($t eq "mpi_abort") {
add_line_general_conf("#undef _GENERIC_EXIT_FUNCTION_MODE_ \n#define _GENERIC_EXIT_FUNCTION_MODE_ _GENERIC_EXIT_FUNCTION__MPI_ABORT_\n");
next;
}
else {
die "Option is unrecognized: -openmpfgf=($1)";
}
}
if (/^-batl-path=(.*)$/i) {
add_line_amps_conf("BATL=$1");
......@@ -316,26 +290,6 @@ foreach (@Arguments) {
next;
}
if (/^-cuda$/i) {
add_line_general_conf("#undef _TARGET_GLOBAL_ \n#define _TARGET_GLOBAL_ __global__");
add_line_general_conf("#undef _TARGET_HOST_ \n#define _TARGET_HOST_ __host__");
add_line_general_conf("#undef _TARGET_DEVICE_ \n#define _TARGET_DEVICE_ __device__");
add_line_general_conf("#undef _CUDA_MODE_ \n#define _CUDA_MODE_ _ON_");
add_line_general_conf("#undef _CUDA_MANAGED_\n#define _CUDA_MANAGED_ __managed__");
#add stuff in Makefile.conf
open (MAKEFILE,">>Makefile.conf") || die "Cannot open Makefile.local\n";
print MAKEFILE ".SUFFIXES: .cu\n.cu.o:\n\tnvcc \${FLAGCC} \$< -o \$@";
close (MAKEFILE);
next;
}
if (/^-no-signals/i) {
add_line_general_conf("#undef _INTERSEPT_OS_SIGNALS_ \n#define _INTERSEPT_OS_SIGNALS_ _OFF_");
next;
}
if (/^-avx=(.*)$/) {
my $t;
......@@ -368,7 +322,7 @@ foreach (@Arguments) {
if (/^-link-option=(.*)$/) {
my $options=$1;
$options =~ s/:/ /g;
$options =~ s/,/ /g;
my $fh;
open($fh,'<',"Makefile");
......@@ -391,7 +345,7 @@ foreach (@Arguments) {
if (/^-f-link-option=(.*)$/) {
my $options=$1;
$options =~ s/:/ /g;
$options =~ s/,/ /g;
my $fh;
open($fh,'<',"Makefile");
......@@ -414,7 +368,7 @@ foreach (@Arguments) {
if (/^-cpp-link-option=(.*)$/) {
my $options=$1;
$options =~ s/:/ /g;
$options =~ s/,/ /g;
my $fh;
open($fh,'<',"Makefile");
......@@ -438,7 +392,7 @@ foreach (@Arguments) {
if (/^-compiler-option=(.*)$/) {
my $options=$1;
$options =~ s/:/ /g;
$options =~ s/,/ /g;
`echo EXTRACOMPILEROPTIONS+=$options >> Makefile.local`;
next;
}
......@@ -479,7 +433,7 @@ foreach (@Arguments) {
my $Opt;
my @OptList;
$options=~s/:/ /g;
$options=~s/,/ /g;
@OptList=split(' ',$options);
my $line;
......
......@@ -12,8 +12,8 @@ OPENMP=off
EXTRACOMPILEROPTIONS=
#extra linker options specific for fortran and c++ linker
EXTRALINKEROPTIONS_F=
EXTRALINKEROPTIONS_CPP=
EXTRALINKEROPTIONS_F=
EXTRALINKEROPTIONS_CPP=
#Compiling with the CCMC's Kameleon
KAMELEON=nokameleon
......@@ -28,18 +28,6 @@ LINK_SWMF_SHARED_LIB=off
#use AVX instructions in the calculations
AVXMODE=off
#individual compiled modules
COMPILE_ELECTRON_IMPACT=on
COMPILE_SPUTTERING=on
COMPILE_DUST=on
COMPILE_CHARGE_EXCHANGE=on
COMPILE_PHOTOLYTIC_REACTIONS=on
COMPILE_EXOSPHERE=on
COMPILE_SURFACE=on
#the list of directories where object files are located
LINK_DIRECTORY_LIST=
include Makefile.conf
include Makefile.def
......@@ -47,41 +35,12 @@ include Makefile.def
#include the local $(MAKE)file (defined the AMPS' compiling variables)
include Makefile.local
#determine the list of the directories to be compiled
ifeq ($(COMPILE_EXOSPHERE),on)
LINK_DIRECTORY_LIST+=models/exosphere/*.o
endif
ifeq ($(COMPILE_SURFACE),on)
LINK_DIRECTORY_LIST+=models/surface/*.o
endif
ifeq ($(COMPILE_ELECTRON_IMPACT),on)
LINK_DIRECTORY_LIST+=models/electron_impact/*.o
endif
ifeq ($(COMPILE_SPUTTERING),on)
LINK_DIRECTORY_LIST+=models/sputtering/*.o
endif
ifeq ($(COMPILE_DUST),on)
LINK_DIRECTORY_LIST+=models/dust/*.o
endif
ifeq ($(COMPILE_CHARGE_EXCHANGE),on)
LINK_DIRECTORY_LIST+=models/charge_exchange/*.o
endif
ifeq ($(COMPILE_PHOTOLYTIC_REACTIONS),on)
LINK_DIRECTORY_LIST+=models/photolytic_reactions/*.o
endif
#the default value of the c++ compiler flags
SEARCH_C=-DMPI_ON -I${CWD}/${WSD}/pic -I${CWD}/${WSD}/main -I${CWD}/srcInterface -I${CWD}/${WSD}/meshAMR -I${CWD}/${WSD}/interface -I${CWD}/${WSD}/general -I${CWD}/${WSD}/models/electron_impact -I${CWD}/${WSD}/models/sputtering -I${CWD}/${WSD}/models/dust -I${CWD}/${WSD}/models/charge_exchange -I${CWD}/${WSD}/models/photolytic_reactions -I${CWD}/${WSD}/species -I${CWD}/${WSD}/models/exosphere -I${CWD}/${WSD}/models/surface -I${SPICE}/include -I${BOOST}/include -I${KAMELEON}/src -I${CWD}/utility/PostProcess -I${SHAREDIR} -I${CWD}
SEARCH_C=-DMPI_ON -LANG:std -I${CWD}/${WSD}/pic -I${CWD}/${WSD}/main -I${CWD}/srcInterface -I${CWD}/${WSD}/meshAMR -I${CWD}/${WSD}/interface -I${CWD}/${WSD}/general -I${CWD}/${WSD}/models/electron_impact -I${CWD}/${WSD}/models/sputtering -I${CWD}/${WSD}/models/dust -I${CWD}/${WSD}/models/charge_exchange -I${CWD}/${WSD}/models/photolytic_reactions -I${CWD}/${WSD}/species -I${CWD}/${WSD}/models/exosphere -I${CWD}/${WSD}/models/surface -I${SPICE}/include -I${BOOST}/include -I${KAMELEON}/src -I${CWD}/utility/PostProcess -I${SHAREDIR} -I${CWD}
SEARCH_C+=${EXTRACOMPILEROPTIONS}
SEARCH_C_GENERAL= ${EXTRACOMPILEROPTIONS}
SEARCH_C_GENERAL=-LANG:std ${EXTRACOMPILEROPTIONS}
#define the "compile kameleon' flag only when KAMELEON is used (to exclude including of the KAMELEON headers on machimes where KAMELEON is not installed)
ifneq ($(KAMELEON),nokameleon)
......@@ -291,13 +250,6 @@ ${WSD}:
./ampsConfig.pl -input ${InputFileAMPS} -no-compile
./utility/CheckMacro.pl ${WSD} -in-place
ifeq ($(COMPILE.mpicxx),nvcc)
cd srcTemp/pic;../../utility/change-ext cpp cu
cd srcTemp/meshAMR;../../utility/change-ext cpp cu
cd srcTemp/main;../../utility/change-ext cpp cu
cd srcTemp/general;../../utility/change-ext cpp cu
endif
LIB:
@(if [ -d ${WSD} ]; then rm -rf ${WSD}; fi)
$(MAKE) ${WSD}
......@@ -312,46 +264,24 @@ endif
cd ${WSD}/meshAMR; $(MAKE) SEARCH_C="${SEARCH_C}"
cd ${WSD}/pic; $(MAKE) SEARCH_C="${SEARCH_C}" SEARCH="${SEARCH_F}"
cd ${WSD}/species; $(MAKE) SEARCH_C="${SEARCH_C}"
ifeq ($(COMPILE_EXOSPHERE),on)
cd ${WSD}/models/exosphere; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
ifeq ($(COMPILE_SURFACE),on)
cd ${WSD}/models/surface; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
ifeq ($(COMPILE_ELECTRON_IMPACT),on)
cd ${WSD}/models/electron_impact; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
ifeq ($(COMPILE_SPUTTERING),on)
cd ${WSD}/models/sputtering; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
ifeq ($(COMPILE_DUST),on)
cd ${WSD}/models/dust; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
ifeq ($(COMPILE_CHARGE_EXCHANGE),on)
cd ${WSD}/models/charge_exchange; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
ifeq ($(COMPILE_PHOTOLYTIC_REACTIONS),on)
cd ${WSD}/models/photolytic_reactions; $(MAKE) SEARCH_C="${SEARCH_C}"
endif
cd ${WSD}/models/photolytic_reactions; $(MAKE) SEARCH_C="${SEARCH_C}"
cd ${WSD}/main; $(MAKE) SEARCH_C="${SEARCH_C}"
cp -f ${WSD}/main/mainlib.a ${WSD}/libAMPS.a
ifeq ($(SPICE),nospice)
cd ${WSD}; ${AR} libAMPS.a general/*.o meshAMR/*.o pic/*.o species/*.o $(LINK_DIRECTORY_LIST)
cd ${WSD}; ${AR} libAMPS.a general/*.o meshAMR/*.o pic/*.o species/*.o models/exosphere/*.o models/surface/*.o models/electron_impact/*.o models/sputtering/*.o models/dust/*.o models/charge_exchange/*.o models/photolytic_reactions/*.o
else
rm -rf ${WSD}/tmpSPICE
mkdir ${WSD}/tmpSPICE
cp ${SPICE}/lib/cspice.a ${WSD}/tmpSPICE
cd ${WSD}/tmpSPICE; ar -x cspice.a
cd ${WSD}; ${AR} libAMPS.a general/*.o meshAMR/*.o pic/*.o species/*.o $(LINK_DIRECTORY_LIST) tmpSPICE/*.o
cd ${WSD}; ${AR} libAMPS.a general/*.o meshAMR/*.o pic/*.o species/*.o models/exosphere/*.o models/surface/*.o models/electron_impact/*.o models/sputtering/*.o models/dust/*.o models/charge_exchange/*.o models/photolytic_reactions/*.o tmpSPICE/*.o
endif
ifeq ($(INTERFACE),on)
......@@ -370,13 +300,8 @@ amps_after_build: LIB_after_build
$(MAKE) amps_link
amps_link:
ifeq ($(COMPILE.mpicxx),nvcc)
nvcc -o amps-link.a -dlink srcTemp/main/main.a srcTemp/libAMPS.a
mpif90 -o amps -g amps-link.a srcTemp/main/main.a srcTemp/libAMPS.a -lstdc++ share/lib/libSHARE.a ${EXTRALINKEROPTIONS_F}
else
${AMPSLINKER} -o amps srcTemp/main/main.a srcTemp/libAMPS.a \
${CPPLIB} ${AMPSLINKLIB} ${EXTRALINKEROPTIONS}
endif
.PHONY: test
test:
......
......@@ -598,8 +598,8 @@ Compile=
>>>-cd SWMF-IH/SWMF;Scripts/Configure.pl -on=SP,SC,IH,PT -off=IM,IE,RB
>>>-cd SWMF-IH/SWMF;./Config.pl -v=Empty,SC/BATSRUS,IH/BATSRUS,SP/MFLAMPA,PT/AMPS
>>>-cd SWMF-IH/SWMF;./Config.pl -o=SC:u=AwsomR,e=Awsom,ng=2,g=4,4,4
>>>-cd SWMF-IH/SWMF;./Config.pl -o=IH:u=AwsomR,e=Awsom,ng=2,g=4,4,4
>>>-cd SWMF-IH/SWMF;./Config.pl -o=SC:u=Awsom,e=Awsom,ng=2,g=4,4,4
>>>-cd SWMF-IH/SWMF;./Config.pl -o=IH:u=Awsom,e=Awsom,ng=2,g=4,4,4
>>>-cd SWMF-IH/SWMF;./Config.pl -o=SP:g=2000
>>>-cd SWMF-IH/SWMF;./Config.pl -o=PT:spice-path=nospice,spice-kernels=nospice,application=test/sep_focused_transport-ih-borovikov,amps-test=on
>>>-cd SWMF-IH/SWMF;${MAKE} SWMF
......@@ -897,7 +897,7 @@ Compile=
>>>cd BATL;make READAMRLIB
>>>./Config.pl -application=test/earth-cutoff-rigidity -spice-path=nospice -batl-path=${PTDIR}/BATL -amps-test=on -cplr-data-path=${TESTEarth-cutoff-rigidityKEYS}
>>>./Config.pl -application=test/earth-cutoff-rigidity -spice-path=nospice -batl-path=${PTDIR}/BATL -amps-test=on -cplr-data-path=${TESTEarth-cutoff-rigidityKEYS}
>>>cp Makefile.local Makefile.local.bak
>>>./Config.pl -compiler-option=-D_NIGHTLY_TEST_=_NIGHTLY_TEST__CUTOFF_
......@@ -3351,10 +3351,11 @@ Compile=
>>>rm -rf srcTemp
>>>@($(MAKE) -j8 amps)
>>>@echo "test_InterpolateAMR-test_compile... done" >> test_InterpolateAMR-test$(TESTInterpolateAMR-test-REF).diff
>>>@echo "test_InterpolateAMR-test_compile... done" >> test_InterpolateAMR-test$(TESTInterpolateAMR-test-REF).diff
>>>mv Makefile.local.bak Makefile.local
Run=
>>>@echo "test_InterpolateAMR-test_run..." >> test_InterpolateAMR-test.diff
>>>@echo Test test_InterpolateAMR-test has started: `date`
......
......@@ -510,33 +510,6 @@ sub ReadMainBlock {
die "Cannot recognize line $InputFileLineNumber ($line) in $InputFileName.Assembled\n";
}
}
#delect the physical models to compile with the current run
elsif ($s0 eq "INCLUDEMODULE") {
($s0,$s1)=split(' ',$s1,2);
add_line_makefile_local("COMPILE_$s0=on", 0);
my @ModuleList=('EXOSPHEERE', 'SURFACE', 'ELECTRON_IMPACT','SPUTTERING', 'DUST', 'CHARGE_EXCHANGE', 'PHOTOLYTIC_REACTION');
if (!grep($s0,@ModuleList)) {
die "Cannot recognize line $InputFileLineNumber ($line) in $InputFileName.Assembled\n";
}
}
elsif ($s0 eq "EXCLUDEMODULE") {
($s0,$s1)=split(' ',$s1,2);
add_line_makefile_local("COMPILE_$s0=off", 0);
my @ModuleList=('EXOSPHEERE', 'SURFACE', 'ELECTRON_IMPACT','SPUTTERING', 'DUST', 'CHARGE_EXCHANGE', 'PHOTOLYTIC_REACTION');
if (!grep($s0,@ModuleList)) {
die "Cannot recognize line $InputFileLineNumber ($line) in $InputFileName.Assembled\n";
}
}
elsif ($s0 eq "MOVERINTEGRATORMODE") {
$s1=~s/[();]/ /g;
($s0,$s1)=split(' ',$s1,2);
......@@ -1558,8 +1531,8 @@ sub ReadGeneralBlock {
die "Line $InputFileLineNumber ($line) in $InputFileName.Assembled\n";
}
ampsConfigLib::ChangeValueOfVariable("int _CUDA_MANAGED_ PIC::Mesh::BlockElementSendMask::CommunicationDepthSmall",$s0,"pic/pic_block_send_mask.cpp");
ampsConfigLib::ChangeValueOfVariable("int _CUDA_MANAGED_ PIC::Mesh::BlockElementSendMask::CommunicationDepthLarge",$s1,"pic/pic_block_send_mask.cpp");
ampsConfigLib::ChangeValueOfVariable("int PIC::Mesh::BlockElementSendMask::CommunicationDepthSmall",$s0,"pic/pic_block_send_mask.cpp");
ampsConfigLib::ChangeValueOfVariable("int PIC::Mesh::BlockElementSendMask::CommunicationDepthLarge",$s1,"pic/pic_block_send_mask.cpp");
}
### DIVE discretization ###
......
......@@ -176,7 +176,7 @@ Below is one example of applying the functions.
void saveRestartData(FILE* fname){
// Only the root processor can write.
if (PIC::Mesh::mesh->ThisThread==0) {
if (PIC::Mesh::mesh.ThisThread==0) {
fwrite(&iterNumber, sizeof(long int),1, fname);
std::cout<<"save iter number="<<iterNumber<<std::endl;
}
......
......@@ -13,14 +13,6 @@ makefile MPIRUN=mpirun -np 4
makefile LINK_SWMF_SHARED_LIB=on
ExcludeModule=ELECTRON_IMPACT
ExcludeModule=SPUTTERING
ExcludeModule=DUST
ExcludeModule=CHARGE_EXCHANGE
ExcludeModule=PHOTOLYTIC_REACTIONS
ExcludeModule=EXOSPHERE
ExcludeModule=SURFACE
!makefile ExternalModules=models/exosphere
ProjectSourceDirectory=test/srcFastWave
WorkingSourceDirectory=srcTemp !. !srcTemp !the location of the code that will be compiled (current directory == ".")
......
......@@ -13,14 +13,6 @@ makefile MPIRUN=mpirun -np 4
makefile LINK_SWMF_SHARED_LIB=on
ExcludeModule=ELECTRON_IMPACT
ExcludeModule=SPUTTERING
ExcludeModule=DUST
ExcludeModule=CHARGE_EXCHANGE
ExcludeModule=PHOTOLYTIC_REACTIONS
ExcludeModule=EXOSPHERE
ExcludeModule=SURFACE
!makefile ExternalModules=models/exosphere
ProjectSourceDirectory=test/srcFastWave
WorkingSourceDirectory=srcTemp !. !srcTemp !the location of the code that will be compiled (current directory == ".")
......@@ -65,17 +57,16 @@ CouplerMode=off !!file(tecplot) !!off, file, swmf
InitialSampleLength=20
TestRunTotalIteration=50
NastranSurfaceUserData=on
MeshType=uniform !uniform,non-uniform
BlockCells=16,8,4
GhostCells=2,2,2
CommunicationDepth=2,2
divediscretization=yuxi
CorrectionFactorDivE=0.9
!InternalBoundary=off
NastranSurfaceUserData=off !on !!!on, off
ControlParticleInsideNastranSurface=off !!!on,off
NastranSurfaceUserData=on !on !!!on, off
ControlParticleInsideNastranSurface=off !!!on,of
TrajectoryTracing=off !on
MaxSampledTrajectoryNumber=25000
......
......@@ -10,6 +10,7 @@
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <vector>
#include "specfunc.h"
using namespace std;
......@@ -24,7 +25,6 @@ protected:
public:
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
void init(long int n) {
if (size!=0) {
printf("Error: initialization of allocated array_1d object\n");
......@@ -37,35 +37,28 @@ public:
_TARGET_HOST_ _TARGET_DEVICE_
array_1d() {
data=NULL,size=0;
}
_TARGET_HOST_ _TARGET_DEVICE_
array_1d(int n) {
data=NULL,size=0;
init(n);
}
_TARGET_HOST_ _TARGET_DEVICE_
~array_1d() {
if (data!=NULL) delete [] data;
data=NULL,size=0;
}
_TARGET_HOST_ _TARGET_DEVICE_
bool IsAllocated() {return (data!=NULL);}
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
int GetSize() const {
return size;
}
_TARGET_HOST_ _TARGET_DEVICE_
T* get_data_ptr() {return data;}
//===================================================
T sum() const {
T f = (T)0;
......@@ -97,14 +90,12 @@ T* get_data_ptr() {return data;}
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
T operator () (int i) const {
if ((i<0)||(i>=size)) exit(__LINE__,__FILE__,"Error: out of range");
return data[i];
}
_TARGET_HOST_ _TARGET_DEVICE_
T & operator () (int i) {
if ((i<0)||(i>=size)) exit(__LINE__,__FILE__,"Error: out of range");
......
......@@ -23,7 +23,6 @@ protected:
public:
_TARGET_HOST_ _TARGET_DEVICE_
void Deallocate() {
if ((data!=NULL)&&(locally_allocated_data_buiffer==true)) delete [] data;
......@@ -31,7 +30,6 @@ _TARGET_HOST_ _TARGET_DEVICE_
locally_allocated_data_buiffer=false;
}
_TARGET_HOST_ _TARGET_DEVICE_
void init (int n0,int n1,int n2) {
if ((n0<=0)||(n1<=0)||(n2<=0)) {
printf("Error: allocation of array_3d object\n");
......@@ -39,7 +37,6 @@ _TARGET_HOST_ _TARGET_DEVICE_
exit(__LINE__,__FILE__);
}
#ifndef __CUDA_ARCH__
try {
data=new T[n0*n1*n2];
}
......@@ -47,16 +44,12 @@ _TARGET_HOST_ _TARGET_DEVICE_
printf("Memory Error: array_3d() cannot allocate %ld bytes\n", n0*n1*n2*sizeof(T));
exit(__LINE__,__FILE__);
}
#else
data=new T[n0*n1*n2];
#endif
size_dim0=n0,size_dim1=n1,size_dim2=n2;
ndim1_ndim2=n1*n2;
locally_allocated_data_buiffer=true;
}
_TARGET_HOST_ _TARGET_DEVICE_
array_3d() {
data=NULL;
size_dim0=0,size_dim1=0,size_dim2=0;
......@@ -65,13 +58,11 @@ _TARGET_HOST_ _TARGET_DEVICE_
};
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
~array_3d() {
Deallocate();
};
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
array_3d(int n0,int n1,int n2) {
data=NULL;
size_dim0=0,size_dim1=0,size_dim2=0;
......@@ -81,7 +72,6 @@ _TARGET_HOST_ _TARGET_DEVICE_
init(n0,n1,n2);
};
_TARGET_HOST_ _TARGET_DEVICE_
array_3d(T* t,int n0,int n1,int n2) {
data=t;
......@@ -92,15 +82,12 @@ _TARGET_HOST_ _TARGET_DEVICE_
};
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
int size() const {
return size_dim0*size_dim1*size_dim2;
}
_TARGET_HOST_ _TARGET_DEVICE_
bool IsAllocated() {return (data!=NULL);}
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
int size(int idim) {
int res=0;
......@@ -120,7 +107,6 @@ _TARGET_HOST_ _TARGET_DEVICE_
}
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
inline T operator () (int i0,int i1,int i2) const {
if ((i0<0)||(i0>=size_dim0)||(i1<0)||(i1>=size_dim1)||(i2<0)||(i2>=size_dim2)) exit(__LINE__,__FILE__,"Error: out of range");
......@@ -128,20 +114,17 @@ _TARGET_HOST_ _TARGET_DEVICE_
};
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
inline T & operator () (int i0,int i1,int i2) {
if ((i0<0)||(i0>=size_dim0)||(i1<0)||(i1>=size_dim1)||(i2<0)||(i2>=size_dim2)) exit(__LINE__,__FILE__,"Error: out of range");
return data[i0*ndim1_ndim2+size_dim2*i1+i2];
};
_TARGET_HOST_ _TARGET_DEVICE_
inline T* operator () (int i0,int i1) {
if ((i0<0)||(i0>=size_dim0)||(i1<0)||(i1>=size_dim1)) exit(__LINE__,__FILE__,"Error: out of range");
return data+i0*ndim1_ndim2+size_dim2*i1;
};
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
array_3d<T>& operator = (const array_3d<T>& v) {
int i,imax;
......@@ -152,7 +135,6 @@ _TARGET_HOST_ _TARGET_DEVICE_
};
//===================================================
_TARGET_HOST_ _TARGET_DEVICE_
array_3d<T>& operator = (T f) {
int i,imax;
......
......@@ -16,8 +16,8 @@
int DIM=3;
double tau,tmax,GeneralTime=0.0;
unsigned char NS=1;
_CUDA_MANAGED_ int ThisThread=0;
_CUDA_MANAGED_ int TotalThreadsNumber=1;
int ThisThread=0;
int TotalThreadsNumber=1;
bool dsmc_flag=true;
bool chem_flag=false;
......
......@@ -4,7 +4,6 @@
#define DATA
#include "global.dfn"
#include "global.h"
#define DSMCTARGET 0
#define PICTARGET 1
......@@ -14,8 +13,8 @@
extern int DIM;
extern double tau,tmax,GeneralTime;
extern unsigned char NS;
//extern _CUDA_MANAGED_ int ThisThread;
//extern _CUDA_MANAGED_ int TotalThreadsNumber;
extern int ThisThread;
extern int TotalThreadsNumber;
extern bool dsmc_flag;
extern bool chem_flag;
......
......@@ -6,7 +6,3 @@
#include "global.h"
MPI_Comm MPI_GLOBAL_COMMUNICATOR;
_TARGET_DEVICE_ int deviceThisThread=0;
_TARGET_DEVICE_ int deviceTotalThreadsNumber=1;
_TARGET_DEVICE_ int cudaThreadLimitMallocHeapSize=0;
......@@ -21,9 +21,3 @@
#define _AVX_INSTRUCTIONS_USAGE_MODE__OFF_ 2
#define _AVX_INSTRUCTIONS_USAGE_MODE__ON_ _AVX_INSTRUCTIONS_USAGE_MODE__256_
#define _OFF_ 0
#define _ON_ 1
//definition of the exit function used for terminating the code exection in case of an error
#define _GENERIC_EXIT_FUNCTION__EXIT_ 0
#define _GENERIC_EXIT_FUNCTION__MPI_ABORT_ 1