Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated pyEMsoft CMakefile and added the Debug mode for pyEMsoft #142

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Source/pyEMsoft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ if (Fortran_COMPILER_NAME MATCHES "gfortran.*")
set(APP_DIR "${EMsoft_SOURCE_DIR}/Source/pyEMsoft")
set(USERHOMEDIR "$ENV{HOME}")
get_filename_component(EMsoft_BUILD_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} DIRECTORY)
get_filename_component(Compile_Mode ${EMsoft_BUILD_DIR} NAME)

# get the path for JSONFORTRAN library
get_filename_component(JSONFORTRAN_LIBRARY_DIR ${JSONFORTRAN_DIR} DIRECTORY)
get_filename_component(JSONFORTRAN_LIBRARY_DIR ${JSONFORTRAN_LIBRARY_DIR} DIRECTORY)

#-------------------------------------------------------------------------------
# add run_pyEMsoft.sh to Build folder with properly substituted folder locations
Message(STATUS "Configuring run_pyEMsoft.sh script in ${EMsoft_BUILD_DIR} folder")
Expand All @@ -16,7 +22,7 @@ endif()

if (Fortran_COMPILER_NAME MATCHES "ifort.*")
if(WIN32)
Message(STATUS "Python wrapper script is currently not available on Windows")
Message(STATUS "Python wrapper is only available on Windows Subsystem for Linux")
endif()
endif()

47 changes: 40 additions & 7 deletions Source/pyEMsoft/run_pyEMsoft.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#> @date 09/11/19 MDG 1.2 added automatic CMake substitution of all folder paths
#> @date 10/11/19 MDG 1.3 general cleanup and completion of CMake substitutions
#> @date 07/21/20 CZ 1.4 fixed the clsuppport path and linked the EMOpenCLLib library
#> @date 03/23/21 CZ 1.5 corrected the linked libraries(lib64) and added debug mode
#--------------------------------------------------------------------------

#---------------------------
Expand Down Expand Up @@ -100,9 +101,11 @@ EMsoft_Binfolder=@EMsoft_BUILD_DIR@/Bin
pyEMsoft_BUILDfolder=@EMsoft_BUILD_DIR@/pyEMsoft
EMsoft_folder=@EMsoft_SOURCE_DIR@
pyEMsoft_folder=@EMsoft_SOURCE_DIR@/Source/pyEMsoft
#CondaLib=@USERHOMEDIR@/anaconda3/lib
EMsoft_SDK=@EMsoft_SDK@

FFTW3_include=@FFTW3_INCLUDE_DIR@
FFTW3_lib=@FFTW3_LIBRARY@
JSONFORTRAN_lib=@JSONFORTRAN_LIBRARY_DIR@
VERSION="@Compile_Mode@"
#=======================
# derived folders
EMsoftLib=${EMsoft_folder}/Source/EMsoftLib
Expand Down Expand Up @@ -145,27 +148,57 @@ done
echo " run_pyEMsoft.sh: executing f90wrap"
f90wrap -k ${pyEMsoft_folder}/kind_map -m pyEMsoft ${f90_generated_source_files[*]} ${f90_source_files[*]} ${f90_HDF_source_files[*]} ${f90_OpenCL_source_files[*]} \
--skip hipassfilterc hipassfilter carstringify 1>build.log 2>build_error.log

#=======================
# call f2py-f90wrap to build the wrapper library
# build the Release version of pyEMsoft
if [ "$VERSION" == "Release" ];then
echo " run_pyEMsoft.sh: executing f2py-f90wrap ... this can take a very long time (several hours) ..."
f2py-f90wrap -c -m _pyEMsoft f90wrap_*.f90 -I${EMsoftBuildLib} \
-I${EMsoftBuildHDFLib} \
-I${EMsoftBuildOpenCLLib} \
-I@HDF5_INSTALL@/include/static \
-I@CLFortran_INSTALL@/include \
-I@JSONFORTRAN_INSTALL@/include \
-I@FFTW3_INSTALL@/include \
-I${FFTW3_include} \
-L${EMsoft_Binfolder} \
-L@CLFortran_INSTALL@/lib \
-L@JSONFORTRAN_INSTALL@/lib \
-L@FFTW3_INSTALL@/lib \
-L${JSONFORTRAN_lib} \
-L${FFTW3_lib} \
-L@HDF5_INSTALL@/lib \
--link-lapack_opt \
-lgomp -lgfortran \
-lEMsoftLib -lEMsoftHDFLib -lEMOpenCLLib -ljsonfortran -lhdf5 -lhdf5_fortran \
-lclfortran -lfftw3 -lhdf5_cpp -lhdf5_f90cstub -lhdf5_hl_cpp \
-lEMsoftLib -lEMsoftHDFLib -lEMOpenCLLib \
-ljsonfortran -lhdf5 -lhdf5_fortran \
-lclfortran -lhdf5_cpp -lhdf5_f90cstub -lhdf5_hl_cpp \
-lhdf5_tools -lhdf5_hl -lhdf5_hl_fortran -lhdf5_hl_f90cstub 1>>build.log 2>>build_error.log

# build the Debug version of pyEMsoft
elif [ "$VERSION" == "Debug" ]; then
echo " run_pyEMsoft.sh: executing f2py-f90wrap ... this can take a very long time (several hours) ..."
f2py-f90wrap -c -m _pyEMsoft f90wrap_*.f90 -I${EMsoftBuildLib} \
-I${EMsoftBuildHDFLib} \
-I${EMsoftBuildOpenCLLib} \
-I@HDF5_INSTALL@/include/static \
-I@CLFortran_INSTALL@/include \
-I@JSONFORTRAN_INSTALL@/include \
-I${FFTW3_include} \
-L${EMsoft_Binfolder} \
-L@CLFortran_INSTALL@/lib \
-L${JSONFORTRAN_lib} \
-L${FFTW3_lib} \
-L@HDF5_INSTALL@/lib \
--link-lapack_opt \
-lgomp -lgfortran \
-lEMsoftLib -lEMsoftHDFLib -lEMOpenCLLib \
-ljsonfortran_debug -lhdf5_debug -lhdf5_fortran_debug \
-lclfortran_debug -lhdf5_cpp_debug -lhdf5_f90cstub_debug -lhdf5_hl_cpp_debug \
-lhdf5_tools_debug -lhdf5_hl_debug -lhdf5_hl_fortran_debug -lhdf5_hl_f90cstub_debug 1>>build.log 2>>build_error.log

else
echo "Undefined version of compilation"
fi

#=======================
# clean up all the .f90 files that we no longer need
echo " run_pyEMsoft.sh: cleaning up"
Expand Down