Skip to content

Commit

Permalink
getting started on new laptop
Browse files Browse the repository at this point in the history
  • Loading branch information
mbeidler3 committed Feb 9, 2024
1 parent 27122bc commit 076328e
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 71 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required (VERSION 3.5)

project (korc_proj C CXX Fortran)

message(STATUS "CMake system name is ${CMAKE_SYSTEM_NAME}")

# Set directories to build all binary files.
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/build/bin)

Expand Down
13 changes: 8 additions & 5 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ rm -rf CMakeFiles

rm -rf ./build && mkdir $_

export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export FC=/usr/bin/gfortran-12

cmake -DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_OMP=OFF \
-DUSE_PSPLINE=OFF \
-DUSE_FIO=OFF \
-DCORI_DIR=OFF \
-DKORC_TEST=OFF \
-DCMAKE_Fortran_FLAGS="-O3 -DHDF5_DOUBLE_PRESICION -fopenmp -malign-double -fconvert='big-endian'" \
-DCMAKE_C_FLAGS="-O3 -fopenmp -malign-double" \
-DCMAKE_CXX_FLAGS="-O3 -fopenmp -malign-double" \
-DCMAKE_Fortran_FLAGS="-O3 -DHDF5_DOUBLE_PRESICION -fopenmp" \
-DCMAKE_C_FLAGS="-O3 -fopenmp" \
-DCMAKE_CXX_FLAGS="-O3 -fopenm" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -ffpe-trap=invalid,zero,overflow -fbacktrace -Werror" \
-DCMAKE_C_FLAGS_DEBUG="-g -g3" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -g3"
-DCMAKE_C_FLAGS_DEBUG="-g" \
-DCMAKE_CXX_FLAGS_DEBUG="-g"

make VERBOSE=1
49 changes: 48 additions & 1 deletion setup_cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ rm -rf CMakeFiles
echo
if [ $MACHINE_ID == "MBP115573" ]
then
# Config for Matt Beidler's ORNL machine.
# Config for Matt Beidler's ORNL MacBook

rm -f CMakeCache.txt
rm -rf CMakeFiles
Expand Down Expand Up @@ -85,6 +85,53 @@ then
-DNIMSLU_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/externals/libsslu_dummy.a \
-DNIMLUD_LIBRARIES=/Users/21b/Desktop/NIMROD/NIMUW/externals/libslud_dummy.a \

elif [ $NAME == "lap141014" ]
then
# Config for Matt Beidler's WSL2/Ubuntu build

rm -f CMakeCache.txt
rm -rf CMakeFiles

rm -rf ./build && mkdir $_

COMPILER_TYPE=GNU

if [ "$COMPILER_TYPE" == GNU ]
then
export CC=/usr/bin/gcc-12
export CXX=/usr/bin/g++-12
export FC=/usr/bin/gfortran-12

cmake -DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_OMP=OFF \
-DUSE_PSPLINE=OFF \
-DUSE_FIO=OFF \
-DCORI_DIR=OFF \
-DKORC_TEST=OFF \
-DCMAKE_Fortran_FLAGS="-O3 -DHDF5_DOUBLE_PRESICION -fopenmp" \
-DCMAKE_C_FLAGS="-O3 -fopenmp" \
-DCMAKE_CXX_FLAGS="-O3 -fopenmp" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -ffpe-trap=invalid,zero,overflow -fbacktrace -Werror" \
-DCMAKE_C_FLAGS_DEBUG="-g" \
-DCMAKE_CXX_FLAGS_DEBUG="-g" \

elif [ "$COMPILER_TYPE" == NV ]

cmake \
-DCMAKE_BUILD_TYPE:String=$BUILD_TYPE \
-DUSE_OMP=ON \
-DCMAKE_Fortran_FLAGS="-Mfree -Mpreprocess -fPIC -O3 -mp -Mvect=simd:256 -Mbyteswapio -DHDF5_DOUBLE_PRESICION" \
-DCMAKE_Fortran_FLAGS_DEBUG="-g -Minfo=all -Minstrument -traceback -lnvhpcwrapnvtx" \
-DCMAKE_C_FLAGS="-O3 -mp -Mvect=simd:256" \
-DCMAKE_C_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DCMAKE_CXX_FLAGS="-O3 -std=c++11 -mp -Mvect=simd:256" \
-DCMAKE_CXX_FLAGS_DEBUG="-g -Minfo=all -traceback" \
-DUSE_PSPLINE=ON \
then
echo " choose a valid compiler type "
fi


elif [ $LMOD_SYSTEM_NAME == "perlmutter" ]
then

Expand Down
41 changes: 20 additions & 21 deletions src/korc_collisions.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ end subroutine unitVectors_p
subroutine check_collisions_params(spp)
#ifdef PARALLEL_RANDOM
USE omp_lib
#endif PARALLEL_RANDOM
#endif
TYPE(SPECIES), INTENT(IN) :: spp
INTEGER aux

Expand All @@ -1864,7 +1864,7 @@ subroutine check_collisions_params(spp)
cparams_ss%rnd_num = get_random()
#else
call RANDOM_NUMBER(cparams_ss%rnd_num)
#endif PARALLEL_RANDOM
#endif
cparams_ss%rnd_num_count = 1_idef
end if
end subroutine check_collisions_params
Expand Down Expand Up @@ -2223,8 +2223,7 @@ subroutine include_CoulombCollisions_FOfio_p(tt,params,X_X,X_Y,X_Z, &
rnd1(cc,3) = get_random()
#else
call RANDOM_NUMBER(rnd1)
#endif PARALLEL_RANDOM

#endif
dW(cc,1) = SQRT(3*dt)*(-1+2*rnd1(cc,1))
dW(cc,2) = SQRT(3*dt)*(-1+2*rnd1(cc,2))
dW(cc,3) = SQRT(3*dt)*(-1+2*rnd1(cc,3))
Expand Down Expand Up @@ -2298,7 +2297,7 @@ subroutine include_CoulombCollisions_FOfio_p(tt,params,X_X,X_Y,X_Z, &
end if
end subroutine include_CoulombCollisions_FOfio_p

#endif FIO
#endif

subroutine include_CoulombCollisions_GC_p(tt,params,Y_R,Y_PHI,Y_Z, &
Ppll,Pmu,me,flagCon,flagCol,F,P,E_PHI,ne,PSIp)
Expand Down Expand Up @@ -2370,7 +2369,7 @@ subroutine include_CoulombCollisions_GC_p(tt,params,Y_R,Y_PHI,Y_Z, &
end if
endif
call add_analytical_E_p(params,tt,F,E_PHI,Y_R,Y_Z)
#endif PSPLINE
#endif
end if


Expand All @@ -2392,7 +2391,7 @@ subroutine include_CoulombCollisions_GC_p(tt,params,Y_R,Y_PHI,Y_Z, &
else
call interp_FOcollision_p(pchunk,Y_R,Y_PHI,Y_Z,ne,Te,Zeff,flagCon)
endif
#endif PSPLINE
#endif
end if

E_PHI_tmp=E_PHI
Expand Down Expand Up @@ -2433,7 +2432,7 @@ subroutine include_CoulombCollisions_GC_p(tt,params,Y_R,Y_PHI,Y_Z, &
! rnd1(:,2) = get_random_mkl()
#else
call RANDOM_NUMBER(rnd1)
#endif PARALLEL_RANDOM
#endif

dW(cc,1) = SQRT(3*dt)*(-1+2*rnd1(cc,1))
dW(cc,2) = SQRT(3*dt)*(-1+2*rnd1(cc,2))
Expand Down Expand Up @@ -2649,7 +2648,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
gradB_R,gradB_PHI,gradB_Z,flagCon,PSIp,time)
end if
endif
#endif PSPLINE
#endif
if(.not.F%ReInterp_2x1t) call add_analytical_E_p(params,tt,F,E_PHI,Y_R,Y_Z)
end if

Expand All @@ -2673,7 +2672,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
else
call interp_FOcollision_p(achunk,Y_R,Y_PHI,Y_Z,ne,Te,Zeff,flagCon)
endif
#endif PSPLINE
#endif
end if

E_PHI_LAC=E_PHI
Expand Down Expand Up @@ -2716,7 +2715,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
! rnd1(:,2) = get_random_mkl()
#else
call RANDOM_NUMBER(rnd1)
#endif PARALLEL_RANDOM
#endif

dW(cc,1) = SQRT(3*dt)*(-1+2*rnd1(cc,1))
dW(cc,2) = SQRT(3*dt)*(-1+2*rnd1(cc,2))
Expand Down Expand Up @@ -2823,7 +2822,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
call korc_abort(24)
endif
end do
#endif DBG_CHECK
#endif

!$OMP SIMD
do cc=1_idef,achunk
Expand Down Expand Up @@ -2894,7 +2893,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
if (IEEE_IS_NAN(xi(cc)).or.(abs(xi(cc)).gt.1._rp)) then
#else
if (ISNAN(xi(cc)).or.(abs(xi(cc)).gt.1._rp)) then
#endif __NVCOMPILER
#endif
write(6,*) 'xi is NaN or >1 before LAC'
write(6,*) 'p0,xi0',pm0(cc),xi0(cc)
write(6,*) 'p,xi',pm(cc),xi(cc)
Expand All @@ -2906,7 +2905,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
end if

end do
#endif DBG_CHECK
#endif

if (cparams_ss%avalanche) then

Expand Down Expand Up @@ -2990,7 +2989,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
call korc_abort(24)
endif
end do
#endif DBG_CHECK
#endif

end if

Expand All @@ -3000,7 +2999,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
if (IEEE_IS_NAN(xi(cc)).or.(abs(xi(cc)).gt.1._rp)) then
#else
if (ISNAN(xi(cc)).or.(abs(xi(cc)).gt.1._rp)) then
#endif __NVCOMPILER
#endif
write(6,*) 'xi is NaN or >1 after LAC'
write(6,*) 'p0,xi0',pm0(cc),xi0(cc)
write(6,*) 'p,xi',pm(cc),xi(cc)
Expand All @@ -3010,7 +3009,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
call korc_abort(24)
end if
end do
#endif DBG_CHECK
#endif

!$OMP SIMD
do cc=1_idef,achunk
Expand All @@ -3029,7 +3028,7 @@ subroutine include_CoulombCollisionsLA_GC_p(spp,achunk,tt,params, &
call korc_abort(24)
endif
end do
#endif DBG_CHECK
#endif

E_PHI=E_PHI_LAC

Expand Down Expand Up @@ -3150,7 +3149,7 @@ subroutine include_CoulombCollisions_GCfio_p(tt,params,Y_R,Y_PHI,Y_Z, &
! rnd1(:,2) = get_random_mkl()
#else
call RANDOM_NUMBER(rnd1)
#endif PARALLEL_RANDOM
#endif

dW(cc,1) = SQRT(3*dt)*(-1+2*rnd1(cc,1))
dW(cc,2) = SQRT(3*dt)*(-1+2*rnd1(cc,2))
Expand Down Expand Up @@ -3240,7 +3239,7 @@ subroutine include_CoulombCollisions_GCfio_p(tt,params,Y_R,Y_PHI,Y_Z, &
#else
if((isnan(Ppll(cc)).or.isnan(Pmu(cc))).and. &
((flagCol(cc).eq.1_is).and.(flagCon(cc).eq.1_is))) then
#endif __NVCOMPILER
#endif _
write(6,*) 'End collision'
write(6,*) 'Ppll',Ppll(cc)
write(6,*) 'Pmu',Pmu(cc)
Expand All @@ -3265,7 +3264,7 @@ subroutine include_CoulombCollisions_GCfio_p(tt,params,Y_R,Y_PHI,Y_Z, &
stop 'Ppll or Pmu is NaN'
endif
end do
#endif DBG_CHECK
#endif

! write(output_unit_write,'("rnd1: ",E17.10)') rnd1
! write(output_unit_write,'("flag: ",I16)') flag
Expand Down
12 changes: 6 additions & 6 deletions src/korc_interp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ module korc_interp
INTEGER :: ezerr
!! Error status during PSPLINE interpolations.

#endif PSPLINE
#endif

#ifdef PSPLINE
PUBLIC :: interp_fields,&
Expand Down Expand Up @@ -1757,7 +1757,7 @@ subroutine check_if_in_LCFS(F,Y,inLCFS)
!write(6,'("IZ: ",I16)') IZ
!call KORC_ABORT(23)
end if
#endif DBG_CHECK
#endif

!write(output_unit_write,'("IR: ",I16)') IR
!write(output_unit_write,'("IZ: ",I16)') IZ
Expand Down Expand Up @@ -3535,7 +3535,7 @@ subroutine interp_3D_efields(params,Y,E,flag)
DEALLOCATE(F)
end subroutine interp_3D_efields

#endif PSPLINE
#endif

subroutine interp_fields(params,prtcls,F)
!! @note Subroutine that works as an interface for calling the
Expand All @@ -3561,7 +3561,7 @@ subroutine interp_fields(params,prtcls,F)
call check_if_in_fields_domain(F,prtcls%Y, prtcls%flagCon)

if (F%useLCFS) call check_if_in_LCFS(F,prtcls%Y, prtcls%initLCFS)
#endif PSPLINE
#endif
#ifdef FIO
if (TRIM(params%field_model) .eq. 'M3D_C1'.or. &
TRIM(params%field_model) .eq. 'NIMROD') then
Expand Down Expand Up @@ -3591,7 +3591,7 @@ subroutine interp_fields(params,prtcls,F)
end do

end if
#endif FIO
#endif
#ifdef PSPLINE
if (params%field_model(10:13).eq.'MARS') then
call interp_FOfields_mars(prtcls, F, params)
Expand Down Expand Up @@ -3667,7 +3667,7 @@ subroutine interp_fields(params,prtcls,F)
! write(output_unit_write,*) 'interpolated efield'
end if

#endif PSPLINE
#endif
end subroutine interp_fields

#ifdef PSPLINE
Expand Down
Loading

0 comments on commit 076328e

Please sign in to comment.