Commit befor trying to convert particle array to linked list to improve

performance.
This commit is contained in:
Jorge Gonzalez 2020-10-10 21:25:49 +02:00
commit 60f38a2d95
8 changed files with 160 additions and 12 deletions

View file

@ -0,0 +1,54 @@
set terminal qt enhanced 1 size 1600, 1000 font "Times ,10"
set style line 1 pt 4 lc rgb "#B50427" #Squares red
set style line 2 pt 6 lc rgb "#3B4CC1" #Circles blue
set style line 3 pt 1 lc rgb "#2CA02C" #Crosses green
set style line 4 pt 2 lc rgb "#FE7F0E" #Exes orange
set style line 5 pt 8 lc rgb "#D6696B" #Triangles light red
set style line 10 lt 1 lw 2.0 lc rgb "black" #Black solid line
folder1 = "2020-09-27_10.46.31/"
folder2 = "2020-09-28_10.49.22/"
folder3 = "2020-09-30_20.40.04/"
folder4 = "2020-10-01_08.53.50/"
set key box opaque
set pointsize 1.5
set ylabel "Time per particle (ms)"
set xrange [0:8000]
set xlabel "Iteration"
set multiplot layout 2,3
set title "Total"
plot folder1."cpuTime.dat" u 1:(1e3*$3) t "Step 1" ls 1, \
folder2."cpuTime.dat" u 1:(1e3*$3) t "Step 2" ls 2, \
folder3."cpuTime.dat" u 1:(1e3*$3) t "Step 3" ls 3, \
folder4."cpuTime.dat" u 1:(1e3*$3) t "Step 4" ls 4
set title "Push"
plot folder1."cpuTime.dat" u 1:(1e3*$4) t "Step 1" ls 1, \
folder2."cpuTime.dat" u 1:(1e3*$4) t "Step 2" ls 2, \
folder3."cpuTime.dat" u 1:(1e3*$4) t "Step 3" ls 3, \
folder4."cpuTime.dat" u 1:(1e3*$4) t "Step 4" ls 4
set title "Reset"
plot folder1."cpuTime.dat" u 1:(1e3*$5) t "Step 1" ls 1, \
folder2."cpuTime.dat" u 1:(1e3*$5) t "Step 2" ls 2, \
folder3."cpuTime.dat" u 1:(1e3*$5) t "Step 3" ls 3, \
folder4."cpuTime.dat" u 1:(1e3*$5) t "Step 4" ls 4
set title "Collisions"
plot folder1."cpuTime.dat" u 1:(1e3*$6) t "Step 1" ls 1, \
folder2."cpuTime.dat" u 1:(1e3*$6) t "Step 2" ls 2, \
folder3."cpuTime.dat" u 1:(1e3*$6) t "Step 3" ls 3, \
folder4."cpuTime.dat" u 1:(1e3*$6) t "Step 4" ls 4
set title "Weighting"
plot folder1."cpuTime.dat" u 1:(1e3*$7) t "Step 1" ls 1, \
folder2."cpuTime.dat" u 1:(1e3*$7) t "Step 2" ls 2, \
folder3."cpuTime.dat" u 1:(1e3*$7) t "Step 3" ls 3, \
folder4."cpuTime.dat" u 1:(1e3*$7) t "Step 4" ls 4

View file

@ -1,8 +1,8 @@
{
"output": {
"path": "./runs/cylFlow/",
"trigger": 100,
"cpuTime": false,
"trigger": 10,
"cpuTime": true,
"numColl": false
},
"geometry": {
@ -38,5 +38,10 @@
"collisions": [
{"species_i": "Argon", "species_j": "Argon", "crossSections": ["Ar-Ar_Elastic.dat"]}
]
},
"parallel": {
"OpenMP":{
"nThreads": 24
}
}
}

View file

@ -0,0 +1,49 @@
reset
set terminal qt enhanced 1 size 1800, 400 font "Times ,10"
set style line 1 pt 4 lc rgb "#B50427" #Squares red
set style line 2 pt 6 lc rgb "#3B4CC1" #Circles blue
set style line 3 pt 1 lc rgb "#2CA02C" #Crosses green
set style line 4 pt 2 lc rgb "#FE7F0E" #Exes orange
set style line 5 pt 8 lc rgb "#D6696B" #Triangles light red
set style line 10 lt 1 lw 2.0 lc rgb "black" #Black solid line
set style data histogram
set style histogram rowstacked title offset 0,-1
set style fill solid border -1
set boxwidth 0.50
set key box opaque
set yrange [0:100]
set ylabel "CPU Time (%)"
set xrange [0:]
plot "cpuTime.dat" u ($4/$3*100) t "Push" ls 1, \
"" u ($5/$3*100) t "Reset" ls 2, \
"" u ($6/$3*100) t "Collisions" ls 3, \
"" u ($7/$3*100) t "Weighting" ls 4
reset
set terminal qt enhanced 2 size 800, 600 font "Times ,10"
set style line 1 pt 4 lc rgb "#B50427" #Squares red
set style line 2 pt 6 lc rgb "#3B4CC1" #Circles blue
set style line 3 pt 1 lc rgb "#2CA02C" #Crosses green
set style line 4 pt 2 lc rgb "#FE7F0E" #Exes orange
set style line 5 pt 8 lc rgb "#D6696B" #Triangles light red
set style line 10 lt 1 lw 2.0 lc rgb "black" #Black solid line
set key box opaque
set pointsize 1.5
set ylabel "Time per particle ({/Symbol m}s)"
set xrange [0:]
set xlabel "Iteration"
plot "cpuTime.dat" u 1:(1e6*$4/$2) t "Push" ls 1, \
"" u 1:(1e6*$5/$2) t "Reset" ls 2, \
"" u 1:(1e6*$6/$2) t "Collisions" ls 3, \
"" u 1:(1e6*$7/$2) t "Weighting" ls 4

View file

@ -10,17 +10,15 @@ PROGRAM DSMC_Neutrals
USE moduleList
USE moduleOutput
USE moduleCaseParam
USE moduleParallel
IMPLICIT NONE
! t = time step; n = number of particle; e = number of element; i = number of inject
INTEGER:: t, n, e, i
CHARACTER(200):: arg1
CHARACTER(:), ALLOCATABLE:: inputFile
REAL(8), EXTERNAL::omp_get_wtime, omp_get_wtick
REAL(8), EXTERNAL::omp_get_wtime
!Starts threads for OpenMP parallelization
!TODO: make this an input parameter
CALL OMP_SET_NUM_THREADS(8)
!Gets the input file
CALL getarg(1, arg1)
@ -39,6 +37,10 @@ PROGRAM DSMC_Neutrals
PRINT *, "t/tmax: ", t, "/", tmax
PRINT *, "Particles: ", n_part_old
!Starts threads for OpenMP parallelization
!TODO: make this an input parameter
CALL OMP_SET_NUM_THREADS(openMP%nThreads)
!$OMP PARALLEL PRIVATE(t) DEFAULT(SHARED)
DO t = 1, tmax
tStep = omp_get_wtime()

View file

@ -4,7 +4,7 @@ OBJECTS = $(OBJDIR)/$(OUTPUT).o \
$(OBJDIR)/moduleErrors.o $(OBJDIR)/moduleList.o $(OBJDIR)/moduleOutput.o \
$(OBJDIR)/moduleMeshCyl.o $(OBJDIR)/moduleMeshCylRead.o $(OBJDIR)/moduleMeshCylBoundary.o \
$(OBJDIR)/moduleBoundary.o $(OBJDIR)/moduleCaseParam.o $(OBJDIR)/moduleRefParam.o \
$(OBJDIR)/moduleCollisions.o $(OBJDIR)/moduleTable.o
$(OBJDIR)/moduleCollisions.o $(OBJDIR)/moduleTable.o $(OBJDIR)/moduleParallel.o
all: $(OUTPUT)

View file

@ -2,14 +2,15 @@
OBJS = moduleCaseParam.o moduleCompTime.o moduleList.o\
moduleMesh.o moduleMeshCyl.o moduleMeshCylBoundary.o\
moduleMeshCylRead.o moduleOutput.o moduleInput.o \
moduleSolver.o moduleCollisions.o moduleTable.o
moduleSolver.o moduleCollisions.o moduleTable.o \
moduleParallel.o
all: $(OBJS)
moduleCollisions.o: moduleTable.o moduleSpecies.o moduleRefParam.o moduleConstParam.o moduleMeshCyl.f95
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
moduleInput.o: moduleRefParam.o moduleCaseParam.o moduleSolver.o moduleInject.o moduleBoundary.o moduleMesh.o moduleMeshCylRead.o moduleErrors.o moduleSpecies.o moduleInput.f95
moduleInput.o: moduleParallel.o moduleRefParam.o moduleCaseParam.o moduleSolver.o moduleInject.o moduleBoundary.o moduleMesh.o moduleMeshCylRead.o moduleErrors.o moduleSpecies.o moduleInput.f95
$(FC) $(FCFLAGS) -c $(subst .o,.f95, $@) -o $(OBJDIR)/$@
moduleInject.o: moduleSpecies.o moduleSolver.o moduleMesh.o moduleMeshCyl.o moduleInject.f95

View file

@ -45,6 +45,9 @@ MODULE moduleInput
!Read injection of particles
CALL readInject(config)
!Read parallel parameters
CALL readParallel(config)
END SUBROUTINE readConfig
!Reads the reference parameters
@ -325,9 +328,9 @@ MODULE moduleInput
TYPE(json_file), INTENT(inout):: config
INTEGER:: i
character(2):: istring
character(:), allocatable:: object
logical:: found
CHARACTER(2):: istring
CHARACTER(:), ALLOCATABLE:: object
LOGICAL:: found
CHARACTER(:), ALLOCATABLE:: speciesName
CHARACTER(:), ALLOCATABLE:: name
REAL(8):: v
@ -366,4 +369,28 @@ MODULE moduleInput
END SUBROUTINE readInject
SUBROUTINE readParallel(config)
USE moduleParallel
USE moduleErrors
USE json_module
IMPLICIT NONE
TYPE(json_file), INTENT(inout):: config
CHARACTER(:), ALLOCATABLE:: object
LOGICAL:: found
!Reads OpenMP parameters
object = 'parallel.OpenMP'
CALL config%get(object // '.nThreads', openMP%nThreads, found)
IF (.NOT. found) THEN
openMP%nthreads = 8
CALL warningError('No OpenMP configuration detected, using 8 threads as default.')
END IF
END SUBROUTINE readParallel
END MODULE moduleInput

View file

@ -0,0 +1,10 @@
MODULE moduleParallel
TYPE openMP_type
INTEGER:: nThreads
END TYPE
TYPE(openMP_type):: openMP
END MODULE moduleParallel