Merge remote branch 'origin/cmake' into pheno+
This commit is contained in:
commit
a99529b9b0
|
@ -5,3 +5,4 @@
|
||||||
*.bak
|
*.bak
|
||||||
*~
|
*~
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
build
|
||||||
|
|
|
@ -0,0 +1,503 @@
|
||||||
|
########################################################################################
|
||||||
|
# CMAKE for build the Material subroutine for BVP solution
|
||||||
|
########################################################################################
|
||||||
|
cmake_minimum_required (VERSION 2.8.0 FATAL_ERROR)
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
# Find PETSc from system environment
|
||||||
|
set(PETSC_DIR $ENV{PETSC_DIR})
|
||||||
|
if ("${PETSC_DIR}" STREQUAL "")
|
||||||
|
message (FATAL_ERROR "PETSC_DIR is not defined in system!")
|
||||||
|
endif ("${PETSC_DIR}" STREQUAL "")
|
||||||
|
|
||||||
|
# BRUTAL FORCE TO FIND THE VARIABLES DEFINED IN PETSC
|
||||||
|
# ref:
|
||||||
|
# https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake
|
||||||
|
exec_program(mktemp ARGS -d OUTPUT_VARIABLE PETSC_TEMP)
|
||||||
|
|
||||||
|
set(petsc_conf_variables "${PETSC_DIR}/lib/petsc/conf/variables")
|
||||||
|
set(petsc_conf_rules "${PETSC_DIR}/lib/petsc/conf/rules" )
|
||||||
|
# Generate a temporary makerfile to probe the PETSc configuration
|
||||||
|
# This file will be deleted once the setting from PETSc is parsed
|
||||||
|
# into CMake
|
||||||
|
set (petsc_config_makefile "${PETSC_TEMP}/Makefile.petsc")
|
||||||
|
file (WRITE "${petsc_config_makefile}"
|
||||||
|
"## This file was auto generated by CMake
|
||||||
|
# PETSC_DIR = ${PETSC_DIR}
|
||||||
|
SHELL = /bin/sh
|
||||||
|
include ${petsc_conf_rules}
|
||||||
|
include ${petsc_conf_variables}
|
||||||
|
INCLUDE_DIRS := \${PETSC_FC_INCLUDES}
|
||||||
|
LIBRARIES := \${PETSC_WITH_EXTERNAL_LIB}
|
||||||
|
COMPILERF ?= \${FC}
|
||||||
|
LINKERNAME ?= \${FLINKER}
|
||||||
|
includes:
|
||||||
|
\t@echo \${INCLUDE_DIRS}
|
||||||
|
extlibs:
|
||||||
|
\t@echo \${LIBRARIES}
|
||||||
|
compilerf:
|
||||||
|
\t@echo \${COMPILERF}
|
||||||
|
compilerc:
|
||||||
|
\t@echo \${COMPILERC}
|
||||||
|
linker:
|
||||||
|
\t@echo \${LINKERNAME}")
|
||||||
|
|
||||||
|
# CMake will execute each target in the ${petsc_config_makefile}
|
||||||
|
# to acquire corresponding PETSc Variables.
|
||||||
|
# The include path and linking libraries in PETSc usually contains
|
||||||
|
# duplicated entries, which is cleaned up later using CMake list.
|
||||||
|
find_program (MAKE_EXECUTABLE NAMES make gmake)
|
||||||
|
# Find the PETSc includes directory settings
|
||||||
|
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "includes"
|
||||||
|
RESULT_VARIABLE PETSC_INCLUDES_RETURN
|
||||||
|
OUTPUT_VARIABLE petsc_includes
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# Find the PETSc external linking directory settings
|
||||||
|
# //required for final linking, must be appended after the executable
|
||||||
|
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "extlibs"
|
||||||
|
RESULT_VARIABLE PETSC_EXTERNAL_LIB_RETURN
|
||||||
|
OUTPUT_VARIABLE petsc_external_lib
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# The MPI compiler specified in PETSc
|
||||||
|
# //its version information is used to identify whether it is INTEL FORTRAN
|
||||||
|
# //or GNU FORTRAN,
|
||||||
|
# //e.g. for PETSc configured with INTEL FORTRAN compiler
|
||||||
|
# // >>${MPIFC} -v
|
||||||
|
# // ifort version 14.0.3 --> This line is captured and parsed by CMake
|
||||||
|
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "compilerf"
|
||||||
|
RESULT_VARIABLE MPIFC_RETURN
|
||||||
|
OUTPUT_VARIABLE MPIFC
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# PETSc specified linker (MPIF90 + PETSc linking flags)
|
||||||
|
execute_process(COMMAND ${MAKE_EXECUTABLE} --no-print-directory -f ${petsc_config_makefile} "linker"
|
||||||
|
RESULT_VARIABLE PETSC_LINKER_RETURN
|
||||||
|
OUTPUT_VARIABLE PETSC_LINKER
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
# Remove temporary makefile, no need to keep it anymore.
|
||||||
|
file (REMOVE ${petsc_config_makefile})
|
||||||
|
|
||||||
|
# REMOVE DUPLICATE FLAGS FOR COMPILER AND LINKING
|
||||||
|
string( REGEX MATCHALL "-I([^\" ]+)" TMP_LIST "${petsc_includes}")
|
||||||
|
list(REMOVE_DUPLICATES TMP_LIST)
|
||||||
|
foreach (dir ${TMP_LIST})
|
||||||
|
set(PETSC_INCLUDES "${PETSC_INCLUDES} ${dir}")
|
||||||
|
endforeach(dir)
|
||||||
|
string( REGEX MATCHALL "-[lLW]([^\" ]+)" TMP_LIST "${petsc_external_lib}")
|
||||||
|
list(REMOVE_DUPLICATES TMP_LIST)
|
||||||
|
foreach (exlib ${TMP_LIST})
|
||||||
|
set(PETSC_EXTERNAL_LIB "${PETSC_EXTERNAL_LIB} ${exlib}")
|
||||||
|
endforeach(exlib)
|
||||||
|
|
||||||
|
set(CMAKE_Fortran_COMPILER "${MPIFC}")
|
||||||
|
project (DAMASK Fortran)
|
||||||
|
|
||||||
|
# Find DAMASK version (DAMASK_V) in DAMASK_ROOT
|
||||||
|
find_program (CAT_EXECUTABLE NAMES cat)
|
||||||
|
execute_process(COMMAND ${CAT_EXECUTABLE} ${PROJECT_SOURCE_DIR}/VERSION
|
||||||
|
RESULT_VARIABLE DAMASK_VERSION_RETURN
|
||||||
|
OUTPUT_VARIABLE DAMASK_V
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
message("***Found PETSC_DIR:\n${PETSC_DIR}\n" )
|
||||||
|
message("***Found PETSC_INCLUDES:\n${PETSC_INCLUDES}\n" )
|
||||||
|
message("***Found PETSC_EXTERNAL_LIB:\n${PETSC_EXTERNAL_LIB}\n")
|
||||||
|
message("***Found PETSC_LINKER:\n${PETSC_LINKER}\n" )
|
||||||
|
message("***Found FORTRAN MPI COMPILER:\n${MPIFC}\n" )
|
||||||
|
|
||||||
|
|
||||||
|
# # https://cmake.org/Wiki/CMake_FAQ#How_do_I_use_a_different_compiler.3F
|
||||||
|
#---------------------------------------------------------------------------------------
|
||||||
|
# Now start to care about DAMASK
|
||||||
|
|
||||||
|
# THE VERSION NUMBER.
|
||||||
|
set (DAMASK_VERSION_MAJOR 1)
|
||||||
|
set (DAMASK_VERSION_MINOR ${DAMASK_V})
|
||||||
|
|
||||||
|
# Built-in options for DAMASK build system
|
||||||
|
# -> can be overwritten from commandline/install_script
|
||||||
|
option(OPENMP "Use OpenMP libaries for DAMASK" ON )
|
||||||
|
option(OPTIMIZATION "DAMASK optimization level [OFF,DEFENSIVE,AGGRESSIVE]" "DEFENSIVE" )
|
||||||
|
option(SPECTRAL "Build spectral sovler for DAMASAK" OFF )
|
||||||
|
option(FEM "Build FEM solver for DAMASK" OFF )
|
||||||
|
|
||||||
|
if (NOT DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
endif(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
# COMPILE VARIABLES
|
||||||
|
add_definitions(-DDAMASKVERSION="${DAMASK_V}")
|
||||||
|
add_definitions(-DPETSc)
|
||||||
|
add_definitions(-DFLOAT=8)
|
||||||
|
add_definitions(-DINT=4)
|
||||||
|
|
||||||
|
# Setting installation prefix
|
||||||
|
if (DEFINED DAMASK_INSTALL)
|
||||||
|
set (CMAKE_INSTALL_PREFIX "${DAMASK_INSTALL}")
|
||||||
|
else(DEFINED DAMASK_INSTALL)
|
||||||
|
set (CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/bin")
|
||||||
|
endif(DEFINED DAMASK_INSTALL)
|
||||||
|
message("\n***The binary will be installed at\n${CMAKE_INSTALL_PREFIX}\n")
|
||||||
|
|
||||||
|
# DAMASK DRIVER SELECTION
|
||||||
|
if ("${DAMASK_DRIVER}" STREQUAL "SPECTRAL")
|
||||||
|
set (SPECTRAL ON )
|
||||||
|
add_definitions(-DSpectral)
|
||||||
|
set (FEM OFF)
|
||||||
|
message("***Confiugring Spectral Solver\n")
|
||||||
|
elseif ("${DAMASK_DRIVER}" STREQUAL "FEM")
|
||||||
|
set (FEM ON )
|
||||||
|
add_definitions(-DFEM)
|
||||||
|
set (SPECTRAL OFF)
|
||||||
|
message("***Confiugring FEM Solver\n")
|
||||||
|
endif("${DAMASK_DRIVER}" STREQUAL "SPECTRAL")
|
||||||
|
|
||||||
|
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} ${PETSC_INCLUDES}" )
|
||||||
|
set (DAMASK_INCLUDE_FLAGS "${DAMASK_INCLUDE_FLAGS} -I${PROJECT_SOURCE_DIR}/lib")
|
||||||
|
|
||||||
|
if ("${OPTIMIZATION}" STREQUAL "OFF")
|
||||||
|
set (OPTIMIZATION_ifort "-O0 -no-ip")
|
||||||
|
set (OPTIMIZATION_gfortran "-O0" )
|
||||||
|
elseif ("${OPTIMIZATION}" STREQUAL "DEFENSIVE")
|
||||||
|
set (OPTIMIZATION_ifort "-O2")
|
||||||
|
set (OPTIMIZATION_gfortran "-O2")
|
||||||
|
elseif ("${OPTIMIZATION}" STREQUAL "AGGRESSIVE") #ToDo: this is not fully correct here, check old makefile
|
||||||
|
set (OPTIMIZATION_ifort "-ipo -O3 -no-prec-div -fp-model fast=2 -xHost" ) #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost"
|
||||||
|
set (OPTIMIZATION_gfortran "-O3 -ffast-math -funroll-loops -ftree-vectorize")
|
||||||
|
else("${OPTIMIZATION}" STREQUAL "OFF")
|
||||||
|
set (OPTIMIZATION_ifort "-O2")
|
||||||
|
set (OPTIMIZATION_gfortran "-O2")
|
||||||
|
endif("${OPTIMIZATION}" STREQUAL "OFF")
|
||||||
|
|
||||||
|
|
||||||
|
###################################################################################################
|
||||||
|
# COMPILE SWITCHES
|
||||||
|
# -shared-intel: Link against shared Intel libraries instead of static ones
|
||||||
|
# -fpp: preprocessor
|
||||||
|
# -ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0
|
||||||
|
# -assume byterecl record length is given in bytes (also set by -standard-semantics)
|
||||||
|
# fpe_summary print list of floating point exceptions occured during execution
|
||||||
|
# -fimplicit-none: assume "implicit-none" even if not present in source
|
||||||
|
# -diag-disable: disables warnings, where
|
||||||
|
# warning ID 5268: the text exceeds right hand column allowed on the line (we have only comments there)
|
||||||
|
# -warn: enables warnings, where
|
||||||
|
# declarations: any undeclared names (alternative name: -implicitnone)
|
||||||
|
# general: warning messages and informational messages are issued by the compiler
|
||||||
|
# usage: questionable programming practices
|
||||||
|
# interfaces: checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks
|
||||||
|
# ignore_loc: %LOC is stripped from an actual argument
|
||||||
|
# alignments: data that is not naturally aligned
|
||||||
|
# unused: declared variables that are never used
|
||||||
|
# stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK)
|
||||||
|
#
|
||||||
|
###################################################################################################
|
||||||
|
# MORE OPTIONS FOR DEBUGGING DURING COMPILATION
|
||||||
|
# -warn: enables warnings, where
|
||||||
|
# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132)
|
||||||
|
# uncalled: Determines whether warnings occur when a statement function is never called
|
||||||
|
# all:
|
||||||
|
# -name as_is: case sensitive Fortran!
|
||||||
|
###################################################################################################
|
||||||
|
if(${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
|
||||||
|
|
||||||
|
if (OPENMP)
|
||||||
|
set (OPENMP_FLAG "-openmp -openmp-report0 -parallel")
|
||||||
|
endif(OPENMP)
|
||||||
|
|
||||||
|
if ("${OPTIMIZATION}" STREQUAL "OFF")
|
||||||
|
set (OPTIMIZATION_FLAG "-O0 -no-ip")
|
||||||
|
elseif ("${OPTIMIZATION}" STREQUAL "AGGRESSIVE") #ToDo: this is not fully correct here, check old makefile
|
||||||
|
set (OPTIMIZATION_FLAG "-ipo -O3 -no-prec-div -fp-model fast=2 -xHost" ) #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost"
|
||||||
|
elseif ("${OPTIMIZATION}" STREQUAL "ULTRA")
|
||||||
|
set (OPTIMIZATION_FLAG "-ipo -O3 -no-prec-div -fp-model fast=2 -xHost" ) #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost"
|
||||||
|
else() # this is the default
|
||||||
|
set (OPTIMIZATION_FLAG "-O2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (STANDARD_CHECK "-stand f08 -standard-semantics")
|
||||||
|
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -fpp" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -ftz" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -assume byterecl,fpe_summary")
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -diag-disable 5268" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn declarations" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn general" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn usage" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn interfaces" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn ignore_loc" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn alignments" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -warn unused" )
|
||||||
|
###################################################################################################
|
||||||
|
# COMPILE SWITCHES FOR RUNTIME DEBUGGING
|
||||||
|
# -g: Generate symbolic debugging information in the object file
|
||||||
|
# -traceback: Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time.
|
||||||
|
# -gen-interfaces: Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/
|
||||||
|
# -fp-stack-check: Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state.
|
||||||
|
# -ftrapuv Trap uninitalized variables
|
||||||
|
# -check: checks at runtime, where
|
||||||
|
# bounds: check if an array index is too small (<1) or too large!
|
||||||
|
# format: Checking for the data type of an item being formatted for output.
|
||||||
|
# output_conversion: Checking for the fit of data items within a designated format descriptor field.
|
||||||
|
# pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects.
|
||||||
|
# uninit: Checking for uninitialized variables.
|
||||||
|
# -fpe-all0 capture all floating-point exceptions, sets -ftz automatically
|
||||||
|
# -warn: enables warnings, where
|
||||||
|
# errors: warnings are changed to errors
|
||||||
|
# stderrors: warnings about Fortran standard violations are changed to errors
|
||||||
|
# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/
|
||||||
|
###################################################################################################
|
||||||
|
# MORE OPTIONS FOR RUNTIME DEBUGGING
|
||||||
|
# -heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits
|
||||||
|
# -check: checks at runtime, where
|
||||||
|
# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?)
|
||||||
|
# stack:
|
||||||
|
###################################################################################################
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -g" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -traceback" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -gen-interfaces" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-stack-check" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fp-model strict" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -check bounds,format,output_conversion,pointers,uninit" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -ftrapuv" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fpe-all0" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn errors" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -warn stderrors" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -debug-parameters all" )
|
||||||
|
|
||||||
|
set (LINKER_FLAG " -shared-intel")
|
||||||
|
|
||||||
|
###################################################################################################
|
||||||
|
#-real-size 32: set precision to one of those 32/64/128 (= 4/8/16 bytes) for standard real (=8 for pReal)
|
||||||
|
#-integer-size 16: set precision to one of those 16/32/64 (= 2/4/8 bytes) for standard integer (=4 for pInt)
|
||||||
|
###################################################################################################
|
||||||
|
set (PRECISION "-real-size 64 -integer-size 32")
|
||||||
|
###################################################################################################
|
||||||
|
# COMPILE SWITCHES
|
||||||
|
# -shared
|
||||||
|
# -Wl,-undefined,dynamic_lookup:ensure to link against dynamic libraries
|
||||||
|
# -xf95-cpp-input: preprocessor
|
||||||
|
# -ffree-line-length-132: restrict line length to the standard 240 characters (lattice.f90 require larger)
|
||||||
|
# -ffpe-summary: print summary of floating point exeptions (‘invalid’, ‘zero’, ‘overflow’, ‘underflow’, ‘inexact’ and ‘denormal’)
|
||||||
|
# -fimplicit-none: assume "implicit-none" even if not present in source
|
||||||
|
# -fmodule-private: assume "private" even if not present in source
|
||||||
|
# -Wcharacter-truncation: warn if character expressions (strings) are truncated
|
||||||
|
# -Wunderflow: produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation
|
||||||
|
# -Wsuggest-attribute=pure:
|
||||||
|
# -Wsuggest-attribute=noreturn:
|
||||||
|
# -Wconversion-extra
|
||||||
|
# -Wimplicit-procedure
|
||||||
|
# -Wall: sets the following Fortran options:
|
||||||
|
# -Waliasing: warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)" in a call with an explicit interface.
|
||||||
|
# -Wampersand: checks if a character expression is continued proberly by an ampersand at the end of the line and at the beginning of the new line
|
||||||
|
# -Warray-bounds: checks if array reference is out of bounds at compile time. use -fcheck-bounds to also check during runtime
|
||||||
|
# -Wconversion: warn about implicit conversions between different type
|
||||||
|
# -Wsurprising: warn when "suspicious" code constructs are encountered. While technically legal these usually indicate that an error has been made.
|
||||||
|
# -Wc-binding-type:
|
||||||
|
# -Wintrinsics-std: only standard intrisics are available, e.g. "call flush(6)" will cause an error
|
||||||
|
# -Wno-tabs: do not allow tabs in source
|
||||||
|
# -Wintrinsic-shadow: warn if a user-defined procedure or module procedure has the same name as an intrinsic
|
||||||
|
# -Wline-truncation:
|
||||||
|
# -Wtarget-lifetime:
|
||||||
|
# -Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter
|
||||||
|
# -Wunused: a number of unused-xxx warnings
|
||||||
|
# these are general (non -Fortran options) implied by -Wall
|
||||||
|
# -Waddress
|
||||||
|
# -Warray-bounds (only with -O2)
|
||||||
|
# -Wc++11-compat
|
||||||
|
# -Wchar-subscripts
|
||||||
|
# -Wcomment
|
||||||
|
# -Wformat
|
||||||
|
# -Wmaybe-uninitialized
|
||||||
|
# -Wnonnull
|
||||||
|
# -Wparentheses
|
||||||
|
# -Wpointer-sign
|
||||||
|
# -Wreorder
|
||||||
|
# -Wreturn-type
|
||||||
|
# -Wsequence-point
|
||||||
|
# -Wstrict-aliasing
|
||||||
|
# -Wstrict-overflow=1
|
||||||
|
# -Wswitch
|
||||||
|
# -Wtrigraphs
|
||||||
|
# -Wuninitialized
|
||||||
|
# -Wunknown-pragmas
|
||||||
|
# -Wunused-function
|
||||||
|
# -Wunused-label
|
||||||
|
# -Wunused-value
|
||||||
|
# -Wunused-variable
|
||||||
|
# -Wvolatile-register-var
|
||||||
|
# -Wextra: sets the following Fortran options:
|
||||||
|
# -Wunuses-parameter:
|
||||||
|
# -Wcompare-reals:
|
||||||
|
# these are general (non -Fortran options) implied by -Wextra
|
||||||
|
# -Wclobbered
|
||||||
|
# -Wempty-body
|
||||||
|
# -Wignored-qualifiers
|
||||||
|
# -Wmissing-field-initializers
|
||||||
|
# -Woverride-init
|
||||||
|
# -Wsign-compare
|
||||||
|
# -Wtype-limits
|
||||||
|
# -Wuninitialized
|
||||||
|
# -Wunused-but-set-parameter (only with -Wunused or -Wall)
|
||||||
|
# -Wno-globals
|
||||||
|
# -ffpe-summary=all only for newer gfortran
|
||||||
|
###################################################################################################
|
||||||
|
# MORE OPTIONS FOR DEBUGGING DURING COMPILATION
|
||||||
|
# -Warray-temporarieswarnings: because we have many temporary arrays (performance issue?):
|
||||||
|
# -Wimplicit-interface: no interfaces for lapack routines
|
||||||
|
# -Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions.
|
||||||
|
# -Wstrict-overflow:
|
||||||
|
###################################################################################################
|
||||||
|
elseif(${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
|
||||||
|
|
||||||
|
if (OPENMP)
|
||||||
|
set (OPENMP_FLAG "-fopenmp")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if ("${OPTIMIZATION}" STREQUAL "OFF")
|
||||||
|
set (OPTIMIZATION_FLAG "-O0" )
|
||||||
|
elseif ("${OPTIMIZATION}" STREQUAL "AGGRESSIVE") #ToDo: this is not fully correct here, check old makefile
|
||||||
|
set (OPTIMIZATION_FLAG "-O3 -ffast-math -funroll-loops -ftree-vectorize")
|
||||||
|
elseif ("${OPTIMIZATION}" STREQUAL "ULTRA")
|
||||||
|
set (OPTIMIZATION_FLAG "-O3 -ffast-math -funroll-loops -ftree-vectorize")
|
||||||
|
else() # this is the default
|
||||||
|
set (OPTIMIZATION_FLAG "-O2")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (STANDARD_CHECK "-std=f2008ts -pedantic-errors" )
|
||||||
|
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -xf95-cpp-input" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -ffree-line-length-132" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -fimplicit-none" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -fmodule-private" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wall" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wextra" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wcharacter-truncation" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wunderflow" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wsuggest-attribute=pure" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wsuggest-attribute=noreturn")
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wconversion-extra" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wimplicit-procedure" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-unused-parameter" )
|
||||||
|
set (COMPILE_FLAGS "${COMPILE_FLAGS} -fno-range-check" )
|
||||||
|
|
||||||
|
set (LINKER_FLAG " -Wl,-undefined,dynamic_lookup")
|
||||||
|
|
||||||
|
###################################################################################################
|
||||||
|
# COMPILE SWITCHES FOR RUNTIME DEBUGGING
|
||||||
|
# -ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent)
|
||||||
|
# zero,\
|
||||||
|
# overflow
|
||||||
|
# -fcheck=all: sets the following Fortran options:
|
||||||
|
# array-temps
|
||||||
|
# bounds
|
||||||
|
# do
|
||||||
|
# mem
|
||||||
|
# pointer
|
||||||
|
# recursion
|
||||||
|
###################################################################################################
|
||||||
|
# MORE OPTIONS FOR RUNTIME DEBUGGING
|
||||||
|
# -ffpe-trap=precision,\
|
||||||
|
# denormal, \
|
||||||
|
# underflow
|
||||||
|
###################################################################################################
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -g" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fbacktrace" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fdump-core" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -fcheck=all" )
|
||||||
|
set (DEBUG_FLAGS "${DEBUG_FLAGS} -ffpe-trap=invalid,zero,overflow")
|
||||||
|
|
||||||
|
###################################################################################################
|
||||||
|
#-fdefault-real-8: set precision to 8 bytes for standard real (=8 for pReal). Will set size of double to 16 bytes as long as -fdefault-double-8 is not set
|
||||||
|
#-fdefault-double-8: set precision to 8 bytes for double real, would be 16 bytes because -fdefault-real-8 is used
|
||||||
|
#-fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4)
|
||||||
|
###################################################################################################
|
||||||
|
set (PRECISION "-fdefault-real-8 -fdefault-double-8")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPENMP_FLAG}" )
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${STANDARD_CHECK}" )
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${OPTIMIZATION_FLAG}" )
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${COMPILE_FLAGS}")
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${PRECISION}" )
|
||||||
|
|
||||||
|
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPENMP_FLAG}" )
|
||||||
|
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${STANDARD_CHECK}")
|
||||||
|
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OPTIMIZATION_FLAG}" )
|
||||||
|
set (CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${LINKER_FLAG}" )
|
||||||
|
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${CMAKE_Fortran_FLAGS_RELEASE}")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DEBUG_FLAGS}" )
|
||||||
|
|
||||||
|
# Try to add PREFIX and SUFFIX to compiler chain
|
||||||
|
if (DEFINED BUILDCMD_PRE AND DEFINED BUILDCMD_POST)
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
|
||||||
|
set (CMAKE_LINKER "${PETSC_LINKER}")
|
||||||
|
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${BUILDCMD_PRE} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}")
|
||||||
|
else("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${BUILDCMD_PRE} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_DEBUG} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}")
|
||||||
|
endif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
elseif(NOT DEFINED BUILDCMD_PRE AND DEFINED BUILDCMD_POST)
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS} ${BUILDCMD_POST}")
|
||||||
|
set (CMAKE_LINKER "${PETSC_LINKER}")
|
||||||
|
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}")
|
||||||
|
else("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_DEBUG} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB} ${BUILDCMD_POST}")
|
||||||
|
endif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
elseif(DEFINED BUILDCMD_PRE AND NOT DEFINED BUILDCMD_POST)
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS}")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "${BUILDCMD_PRE} ${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS}")
|
||||||
|
set (CMAKE_LINKER "${PETSC_LINKER}")
|
||||||
|
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${BUILDCMD_PRE} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB}")
|
||||||
|
else("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${BUILDCMD_PRE} ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_DEBUG} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB}")
|
||||||
|
endif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
else(DEFINED BUILDCMD_PRE AND DEFINED BUILDCMD_POST)
|
||||||
|
set (CMAKE_Fortran_FLAGS_RELEASE "${CMAKE_Fortran_FLAGS_RELEASE} ${DAMASK_INCLUDE_FLAGS}")
|
||||||
|
set (CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} ${DAMASK_INCLUDE_FLAGS}")
|
||||||
|
set (CMAKE_LINKER "${PETSC_LINKER}")
|
||||||
|
|
||||||
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_RELEASE} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB}")
|
||||||
|
else("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
set (CMAKE_Fortran_LINK_EXECUTABLE
|
||||||
|
"${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS_DEBUG} <OBJECTS> -o <TARGET> <LINK_LIBRARIES> ${PETSC_EXTERNAL_LIB}")
|
||||||
|
endif("${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||||
|
endif(DEFINED BUILDCMD_PRE AND DEFINED BUILDCMD_POST)
|
||||||
|
|
||||||
|
message("***COMPILE FLAGS:\n${CMAKE_Fortran_FLAGS_RELEASE}\n")
|
||||||
|
message("***LINKER:\n${CMAKE_Fortran_LINK_EXECUTABLE}\n")
|
||||||
|
|
||||||
|
# MOVE to SOURCE DIRECTORY for BUILDING
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
# INSTALL BUILT BINARIES
|
||||||
|
if (SPECTRAL)
|
||||||
|
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_spectral
|
||||||
|
DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
elseif (FEM)
|
||||||
|
INSTALL(PROGRAMS ${PROJECT_BINARY_DIR}/src/DAMASK_FEM
|
||||||
|
DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||||
|
endif(SPECTRAL)
|
||||||
|
|
||||||
|
##
|
||||||
|
# ADD TESTING CASES
|
||||||
|
# add_test (SmokeTestRun
|
||||||
|
# DAMASK_spectral.exe -g test/test1.geom -l test/test.load)
|
||||||
|
|
||||||
|
# Enable Dashboard scripting
|
||||||
|
# include (CTest)
|
||||||
|
# set (CTEST_PROJECT_NAME "DAMASK")
|
48
Makefile
48
Makefile
|
@ -3,40 +3,30 @@ SHELL = /bin/sh
|
||||||
# Makefile for the installation of DAMASK
|
# Makefile for the installation of DAMASK
|
||||||
########################################################################################
|
########################################################################################
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: spectral marc processing
|
all: spectral FEM
|
||||||
|
|
||||||
.PHONY: spectral
|
spectral: build/spectral
|
||||||
spectral:
|
@(cd build/spectral; make --no-print-directory -ws all install;)
|
||||||
$(MAKE) DAMASK_spectral.exe -C code
|
|
||||||
|
|
||||||
.PHONY: FEM
|
build/spectral: build
|
||||||
FEM:
|
@mkdir build/spectral
|
||||||
$(MAKE) DAMASK_FEM.exe -C code
|
@(cd build/spectral; cmake -Wno-dev -DCMAKE_BUILD_TYPE=RELEASE -DDAMASK_DRIVER=SPECTRAL ../..;)
|
||||||
|
|
||||||
.PHONY: marc
|
build: bin
|
||||||
marc:
|
@mkdir build
|
||||||
@./installation/mods_MarcMentat/apply_DAMASK_modifications.sh ${MAKEFLAGS}
|
|
||||||
|
|
||||||
.PHONY: processing
|
bin:
|
||||||
processing:
|
@mkdir bin
|
||||||
@if hash cython 2>/dev/null; then \
|
|
||||||
cd ./lib/damask; \
|
|
||||||
CC=gcc python setup_corientation.py build_ext --inplace; \
|
|
||||||
rm -rv build; \
|
|
||||||
rm *.c; \
|
|
||||||
fi
|
|
||||||
@./installation/compile_CoreModule.py ${MAKEFLAGS}
|
|
||||||
|
|
||||||
.PHONY: tidy
|
FEM: build/FEM
|
||||||
tidy:
|
@(cd build/FEM; make --no-print-directory -ws all install;)
|
||||||
@$(MAKE) tidy -C code >/dev/null
|
|
||||||
|
build/FEM: build
|
||||||
|
@mkdir build
|
||||||
|
@(cd build/FEM; cmake -Wno-dev -DCMAKE_BUILD_TYPE=RELEASE -DDAMASK_DRIVER=FEM ../..;)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@$(MAKE) cleanDAMASK -C code >/dev/null
|
rm -rvf build # standard build directory
|
||||||
|
rm -rvf testing # for testing build (testing script in PRIVATE)
|
||||||
.PHONY: install
|
rm -rvf bin # default binary store location
|
||||||
install:
|
|
||||||
@./installation/symlink_Code.py ${MAKEFLAGS}
|
|
||||||
@./installation/symlink_Processing.py ${MAKEFLAGS}
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# from https://help.github.com/articles/dealing-with-line-endings/
|
|
||||||
#
|
|
||||||
# always use LF, even if the files are edited on windows, they need to be compiled/used on unix
|
|
||||||
* text eol=lf
|
|
||||||
|
|
||||||
# Denote all files that are truly binary and should not be modified.
|
|
||||||
*.png binary
|
|
||||||
*.jpg binary
|
|
|
@ -1,3 +0,0 @@
|
||||||
DAMASK_marc*.f90
|
|
||||||
quit__genmod.f90
|
|
||||||
*.marc
|
|
|
@ -0,0 +1,198 @@
|
||||||
|
# The dependency detection in CMake is not functioning for Fortran
|
||||||
|
# !!! EXPLICIT DEPENDENCY DECLARATION !!!
|
||||||
|
|
||||||
|
# SOME FILES REQUIRE SPECIAL FLAGS
|
||||||
|
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel")
|
||||||
|
# -diag-disable 7410 should disable warning about directory statement
|
||||||
|
# in inquire function, but does not work. hence the other 2 statements
|
||||||
|
SET_SOURCE_FILES_PROPERTIES( "spectral_interface.f90" PROPERTIES
|
||||||
|
COMPILE_FLAGS "-diag-remark 7410 -stand none -warn nostderrors" )
|
||||||
|
elseif (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
|
||||||
|
# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation
|
||||||
|
# --> allows the definition of DAMASK_NaN
|
||||||
|
#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored
|
||||||
|
# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external
|
||||||
|
# --> allows the use of 'isnan'
|
||||||
|
#-fno-fast-math:
|
||||||
|
# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug)
|
||||||
|
SET_SOURCE_FILES_PROPERTIES( "prec.f90" PROPERTIES
|
||||||
|
COMPILE_FLAGS "-fno-range-check -fall-intrinsics -fno-fast-math")
|
||||||
|
#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored
|
||||||
|
# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external
|
||||||
|
# --> allows the use of 'getcwd'
|
||||||
|
SET_SOURCE_FILES_PROPERTIES( "spectral_interface.f90" PROPERTIES
|
||||||
|
COMPILE_FLAGS "-fall-intrinsics")
|
||||||
|
# long lines for interaction matrix
|
||||||
|
SET_SOURCE_FILES_PROPERTIES( "lattice.f90" PROPERTIES
|
||||||
|
COMPILE_FLAGS "-ffree-line-length-240")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(DAMASK_PREC "prec.f90")
|
||||||
|
|
||||||
|
if (SPECTRAL)
|
||||||
|
add_library(DAMASK_INTERFACE "spectral_interface.f90")
|
||||||
|
elseif(FEM)
|
||||||
|
add_library(DAMASK_INTERFACE "DAMASK_FEM_interface.f90")
|
||||||
|
endif(SPECTRAL)
|
||||||
|
target_link_libraries(DAMASK_INTERFACE DAMASK_PREC)
|
||||||
|
|
||||||
|
add_library(DAMASK_IO "IO.f90")
|
||||||
|
target_link_libraries(DAMASK_IO DAMASK_INTERFACE)
|
||||||
|
|
||||||
|
add_library(DAMASK_LIBS "libs.f90")
|
||||||
|
target_link_libraries(DAMASK_LIBS DAMASK_IO)
|
||||||
|
|
||||||
|
add_library(DAMASK_NUMERICS "numerics.f90")
|
||||||
|
target_link_libraries(DAMASK_NUMERICS DAMASK_LIBS)
|
||||||
|
|
||||||
|
add_library(DAMASK_DEBUG "debug.f90")
|
||||||
|
target_link_libraries(DAMASK_DEBUG DAMASK_NUMERICS)
|
||||||
|
|
||||||
|
add_library(DAMASK_FEsolving "FEsolving.f90")
|
||||||
|
target_link_libraries(DAMASK_FEsolving DAMASK_DEBUG)
|
||||||
|
|
||||||
|
add_library(DAMASK_MATH "math.f90")
|
||||||
|
target_link_libraries(DAMASK_MATH DAMASK_FEsolving)
|
||||||
|
|
||||||
|
# SPECTRAL solver and FEM solver use different mesh
|
||||||
|
# source files
|
||||||
|
if (SPECTRAL)
|
||||||
|
add_library(DAMASK_MESH "mesh.f90")
|
||||||
|
target_link_libraries(DAMASK_MESH DAMASK_MATH)
|
||||||
|
endif(SPECTRAL)
|
||||||
|
if (FEM)
|
||||||
|
add_library(DAMASK_FEZoo "FEZoo.f90")
|
||||||
|
target_link_libraries(DAMASK_FEZoo DAMASK_MATH)
|
||||||
|
add_library(DAMASK_MESH "meshFEM.f90")
|
||||||
|
target_link_libraries(DAMASK_MESH DAMASK_FEZoo)
|
||||||
|
endif(FEM)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(DAMASK_MATERIAL "material.f90")
|
||||||
|
target_link_libraries(DAMASK_MATERIAL DAMASK_MESH)
|
||||||
|
|
||||||
|
add_library(DAMASK_LATTICE "lattice.f90")
|
||||||
|
target_link_libraries(DAMASK_LATTICE DAMASK_MATERIAL)
|
||||||
|
add_library(DAMASK_DRIVERS ALIAS DAMASK_LATTICE)
|
||||||
|
|
||||||
|
# For each modular section
|
||||||
|
add_library (DAMASK_PLASTIC "plastic_dislotwin.f90"
|
||||||
|
"plastic_disloUCLA.f90"
|
||||||
|
"plastic_isotropic.f90"
|
||||||
|
"plastic_j2.f90"
|
||||||
|
"plastic_phenopowerlaw.f90"
|
||||||
|
"plastic_titanmod.f90"
|
||||||
|
"plastic_nonlocal.f90"
|
||||||
|
"plastic_none.f90"
|
||||||
|
"plastic_phenoplus.f90")
|
||||||
|
target_link_libraries(DAMASK_PLASTIC DAMASK_DRIVERS)
|
||||||
|
|
||||||
|
add_library (DAMASK_KINEMATICS "kinematics_cleavage_opening.f90"
|
||||||
|
"kinematics_slipplane_opening.f90"
|
||||||
|
"kinematics_thermal_expansion.f90"
|
||||||
|
"kinematics_vacancy_strain.f90"
|
||||||
|
"kinematics_hydrogen_strain.f90")
|
||||||
|
target_link_libraries(DAMASK_KINEMATICS DAMASK_DRIVERS)
|
||||||
|
|
||||||
|
add_library (DAMASK_SOURCE "source_thermal_dissipation.f90"
|
||||||
|
"source_thermal_externalheat.f90"
|
||||||
|
"source_damage_isoBrittle.f90"
|
||||||
|
"source_damage_isoDuctile.f90"
|
||||||
|
"source_damage_anisoBrittle.f90"
|
||||||
|
"source_damage_anisoDuctile.f90"
|
||||||
|
"source_vacancy_phenoplasticity.f90"
|
||||||
|
"source_vacancy_irradiation.f90"
|
||||||
|
"source_vacancy_thermalfluc.f90")
|
||||||
|
target_link_libraries(DAMASK_SOURCE DAMASK_DRIVERS)
|
||||||
|
|
||||||
|
add_library(DAMASK_CONSTITUTIVE "constitutive.f90")
|
||||||
|
target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_PLASTIC )
|
||||||
|
target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_KINEMATICS)
|
||||||
|
target_link_libraries(DAMASK_CONSTITUTIVE DAMASK_SOURCE )
|
||||||
|
|
||||||
|
add_library(DAMASK_CRYSTALLITE "crystallite.f90")
|
||||||
|
target_link_libraries(DAMASK_CRYSTALLITE DAMASK_CONSTITUTIVE)
|
||||||
|
|
||||||
|
add_library(DAMASK_HOMOGENIZATION "homogenization_RGC.f90"
|
||||||
|
"homogenization_isostrain.f90"
|
||||||
|
"homogenization_none.f90")
|
||||||
|
target_link_libraries(DAMASK_HOMOGENIZATION DAMASK_CRYSTALLITE)
|
||||||
|
|
||||||
|
add_library(DAMASK_HYDROGENFLUX "hydrogenflux_isoconc.f90"
|
||||||
|
"hydrogenflux_cahnhilliard.f90")
|
||||||
|
target_link_libraries(DAMASK_HYDROGENFLUX DAMASK_CRYSTALLITE)
|
||||||
|
|
||||||
|
add_library(DAMASK_POROSITY "porosity_none.f90"
|
||||||
|
"porosity_phasefield.f90")
|
||||||
|
target_link_libraries(DAMASK_POROSITY DAMASK_CRYSTALLITE)
|
||||||
|
|
||||||
|
add_library(DAMASK_VACANCYFLUX "vacancyflux_isoconc.f90"
|
||||||
|
"vacancyflux_isochempot.f90"
|
||||||
|
"vacancyflux_cahnhilliard.f90")
|
||||||
|
target_link_libraries(DAMASK_VACANCYFLUX DAMASK_CRYSTALLITE)
|
||||||
|
|
||||||
|
add_library(DAMASK_DAMAGE "damage_none.f90"
|
||||||
|
"damage_local.f90"
|
||||||
|
"damage_nonlocal.f90")
|
||||||
|
target_link_libraries(DAMASK_DAMAGE DAMASK_CRYSTALLITE)
|
||||||
|
|
||||||
|
add_library(DAMASK_THERMAL "thermal_isothermal.f90"
|
||||||
|
"thermal_adiabatic.f90"
|
||||||
|
"thermal_conduction.f90")
|
||||||
|
target_link_libraries(DAMASK_THERMAL DAMASK_CRYSTALLITE)
|
||||||
|
|
||||||
|
add_library(DAMASK_ENGINE "homogenization.f90")
|
||||||
|
target_link_libraries(DAMASK_ENGINE DAMASK_THERMAL )
|
||||||
|
target_link_libraries(DAMASK_ENGINE DAMASK_DAMAGE )
|
||||||
|
target_link_libraries(DAMASK_ENGINE DAMASK_VACANCYFLUX )
|
||||||
|
target_link_libraries(DAMASK_ENGINE DAMASK_POROSITY )
|
||||||
|
target_link_libraries(DAMASK_ENGINE DAMASK_HYDROGENFLUX )
|
||||||
|
target_link_libraries(DAMASK_ENGINE DAMASK_HOMOGENIZATION)
|
||||||
|
|
||||||
|
|
||||||
|
if (FEM)
|
||||||
|
add_library(DAMASK_CPFE "CPFEM.f90")
|
||||||
|
target_link_libraries(DAMASK_CPFE DAMASK_ENGINE)
|
||||||
|
|
||||||
|
add_library(DAMASK_FEM_UTILITY "FEM_utilities.f90")
|
||||||
|
target_link_libraries(DAMASK_FEM_UTILITY DAMASK_CPFE)
|
||||||
|
|
||||||
|
add_library(DAMASK_FEM_BASE "FEM_hydrogenflux.f90"
|
||||||
|
"FEM_porosity.f90"
|
||||||
|
"FEM_vacancyflux.f90"
|
||||||
|
"FEM_damage.f90"
|
||||||
|
"FEM_thermal.f90"
|
||||||
|
"FEM_mech.f90")
|
||||||
|
target_link_libraries(DAMASK_FEM_BASE DAMASK_FEM_UTILITY)
|
||||||
|
|
||||||
|
add_library(DAMASK_FEM_DRIVER "DAMASK_FEM_driver.f90")
|
||||||
|
target_link_libraries(DAMASK_FEM_DRIVER DAMASK_FEM_BASE)
|
||||||
|
|
||||||
|
add_executable(DAMASK_FEM "DAMASK_FEM_driver.f90")
|
||||||
|
target_link_libraries(DAMASK_FEM DAMASK_FEM_DRIVER)
|
||||||
|
endif(FEM)
|
||||||
|
|
||||||
|
if (SPECTRAL)
|
||||||
|
add_library(DAMASK_CPFE "CPFEM2.f90")
|
||||||
|
target_link_libraries(DAMASK_CPFE DAMASK_ENGINE)
|
||||||
|
|
||||||
|
add_library(DAMASK_SPECTRAL_UTILITY spectral_utilities.f90)
|
||||||
|
target_link_libraries(DAMASK_SPECTRAL_UTILITY DAMASK_CPFE)
|
||||||
|
|
||||||
|
add_library(DAMASK_SPECTRAL_BASE "spectral_thermal.f90"
|
||||||
|
"spectral_damage.f90")
|
||||||
|
target_link_libraries(DAMASK_SPECTRAL_BASE DAMASK_SPECTRAL_UTILITY)
|
||||||
|
|
||||||
|
add_library(DAMASK_SPECTRAL_MECH "spectral_mech_AL.f90"
|
||||||
|
"spectral_mech_Polarisation.f90"
|
||||||
|
"spectral_mech_Basic.f90")
|
||||||
|
target_link_libraries(DAMASK_SPECTRAL_MECH DAMASK_SPECTRAL_UTILITY)
|
||||||
|
|
||||||
|
add_library(DAMASK_EXE "DAMASK_spectral.f90")
|
||||||
|
target_link_libraries(DAMASK_EXE DAMASK_CPFE )
|
||||||
|
target_link_libraries(DAMASK_EXE DAMASK_SPECTRAL_BASE)
|
||||||
|
target_link_libraries(DAMASK_EXE DAMASK_SPECTRAL_MECH)
|
||||||
|
|
||||||
|
add_executable(DAMASK_spectral "DAMASK_spectral.f90")
|
||||||
|
target_link_libraries(DAMASK_spectral DAMASK_EXE)
|
||||||
|
endif(SPECTRAL)
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -0,0 +1 @@
|
||||||
|
DAMASK_marc.f90
|
|
@ -27,6 +27,17 @@ LIBRARIES := $(PETSC_WITH_EXTERNAL_LIB)
|
||||||
COMPILERNAME ?= $(FC)
|
COMPILERNAME ?= $(FC)
|
||||||
LINKERNAME ?= $(FLINKER)
|
LINKERNAME ?= $(FLINKER)
|
||||||
|
|
||||||
|
#
|
||||||
|
# setting up for HDF5 support (hard link for now)
|
||||||
|
# 1. Location of HDF5 binaries (with include/ and lib/ underneath)
|
||||||
|
HDF5 = /mnt/research/CMM/opt/hdf5
|
||||||
|
# 2. Location of External Libraries (missing in the 1.8.12 version)
|
||||||
|
LIBZ = /mnt/research/CMM/opt/hdf5/lib/libz.a
|
||||||
|
LIBSZ = /mnt/research/CMM/opt/hdf5/lib/libszip.a
|
||||||
|
# 3. Set libraries for HDF5 (LIBS: shared lib, LIBZ: external lib)
|
||||||
|
HDFLIBS = -I$(HDF5)/include -L$(HDF5)/lib
|
||||||
|
HDFLIBZ = -L$(LIBZ) -L$(LIBSZ)
|
||||||
|
|
||||||
# MPI compiler wrappers will tell if they are pointing to ifort or gfortran
|
# MPI compiler wrappers will tell if they are pointing to ifort or gfortran
|
||||||
COMPILEROUT :=$(shell $(FC) -show)
|
COMPILEROUT :=$(shell $(FC) -show)
|
||||||
# search in FC or COMPILEROUT for gfortran/ifort if not defined
|
# search in FC or COMPILEROUT for gfortran/ifort if not defined
|
||||||
|
@ -295,8 +306,8 @@ PRECISION_gfortran :=-fdefault-real-8 -fdefault-double-8 -DFLOAT=8 -DINT=4
|
||||||
#-fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4)
|
#-fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4)
|
||||||
|
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
COMPILE =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(OPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90))
|
COMPILE =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(OPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90))
|
||||||
COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90))
|
COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90))
|
||||||
###################################################################################################
|
###################################################################################################
|
||||||
SOURCE_FILES = \
|
SOURCE_FILES = \
|
||||||
source_thermal_dissipation.o source_thermal_externalheat.o \
|
source_thermal_dissipation.o source_thermal_externalheat.o \
|
||||||
|
@ -350,7 +361,7 @@ DAMASK_spectral.o: INTERFACENAME := spectral_interface.f90
|
||||||
SPECTRAL_SOLVER_FILES = spectral_mech_AL.o spectral_mech_Basic.o spectral_mech_Polarisation.o \
|
SPECTRAL_SOLVER_FILES = spectral_mech_AL.o spectral_mech_Basic.o spectral_mech_Polarisation.o \
|
||||||
spectral_thermal.o spectral_damage.o
|
spectral_thermal.o spectral_damage.o
|
||||||
|
|
||||||
SPECTRAL_FILES = prec.o DAMASK_interface.o IO.o libs.o numerics.o debug.o math.o \
|
SPECTRAL_FILES = prec.o DAMASK_interface.o IO.o libs.o numerics.o debug.o math.o damask_hdf5.o \
|
||||||
FEsolving.o mesh.o material.o lattice.o \
|
FEsolving.o mesh.o material.o lattice.o \
|
||||||
$(SOURCE_FILES) $(KINEMATICS_FILES) $(PLASTIC_FILES) constitutive.o \
|
$(SOURCE_FILES) $(KINEMATICS_FILES) $(PLASTIC_FILES) constitutive.o \
|
||||||
crystallite.o \
|
crystallite.o \
|
||||||
|
@ -360,10 +371,11 @@ SPECTRAL_FILES = prec.o DAMASK_interface.o IO.o libs.o numerics.o debug.o math.o
|
||||||
spectral_utilities.o \
|
spectral_utilities.o \
|
||||||
$(SPECTRAL_SOLVER_FILES)
|
$(SPECTRAL_SOLVER_FILES)
|
||||||
|
|
||||||
DAMASK_spectral.exe: DAMASK_spectral.o
|
DAMASK_spectral.exe: DAMASK_spectral.o \
|
||||||
|
$(SPECTRAL_FILES)
|
||||||
$(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \
|
$(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \
|
||||||
-o DAMASK_spectral.exe DAMASK_spectral.o \
|
-o DAMASK_spectral.exe DAMASK_spectral.o \
|
||||||
$(SPECTRAL_FILES) $(LIBRARIES) $(SUFFIX)
|
$(SPECTRAL_FILES) $(LIBRARIES) $(HDFLIBS) $(HDFLIBZ) $(SUFFIX)
|
||||||
|
|
||||||
|
|
||||||
DAMASK_spectral.o: DAMASK_spectral.f90 \
|
DAMASK_spectral.o: DAMASK_spectral.f90 \
|
||||||
|
@ -412,7 +424,7 @@ FEM_FILES = prec.o DAMASK_interface.o FEZoo.o IO.o libs.o numerics.o debug.
|
||||||
DAMASK_FEM.exe: DAMASK_FEM_driver.o
|
DAMASK_FEM.exe: DAMASK_FEM_driver.o
|
||||||
$(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \
|
$(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \
|
||||||
-o DAMASK_FEM.exe DAMASK_FEM_driver.o \
|
-o DAMASK_FEM.exe DAMASK_FEM_driver.o \
|
||||||
$(FEM_FILES) $(LIBRARIES) $(SUFFIX)
|
$(FEM_FILES) $(LIBRARIES) $(HDFLIBS) $(HDFLIBZ) $(SUFFIX)
|
||||||
|
|
||||||
DAMASK_FEM_driver.o: DAMASK_FEM_driver.f90 $(FEM_SOLVER_FILES)
|
DAMASK_FEM_driver.o: DAMASK_FEM_driver.f90 $(FEM_SOLVER_FILES)
|
||||||
$(PREFIX) $(COMPILERNAME) $(COMPILE_MAXOPTI) -c ../private/FEM/code/DAMASK_FEM_driver.f90 $(SUFFIX)
|
$(PREFIX) $(COMPILERNAME) $(COMPILE_MAXOPTI) -c ../private/FEM/code/DAMASK_FEM_driver.f90 $(SUFFIX)
|
||||||
|
@ -619,6 +631,12 @@ numerics.o: numerics.f90 \
|
||||||
libs.o: libs.f90 \
|
libs.o: libs.f90 \
|
||||||
IO.o
|
IO.o
|
||||||
|
|
||||||
|
damask_hdf5.o: damask_hdf5.f90 \
|
||||||
|
prec.o \
|
||||||
|
IO.o
|
||||||
|
|
||||||
|
$(PREFIX) $(COMPILERNAME) $(HDFLIBS) $(HDFLIBZ) -c damask_hdf5.f90 $(SUFFIX) -lm
|
||||||
|
|
||||||
IO.o: IO.f90 \
|
IO.o: IO.f90 \
|
||||||
DAMASK_interface.o
|
DAMASK_interface.o
|
||||||
|
|
||||||
|
@ -647,6 +665,7 @@ DAMASK_interface.o: spectral_interface.f90 \
|
||||||
# -diag-disable 7410 should disable warning about directory statement in inquire function, but does not work. hence the other 2 statements
|
# -diag-disable 7410 should disable warning about directory statement in inquire function, but does not work. hence the other 2 statements
|
||||||
prec.o: prec.f90
|
prec.o: prec.f90
|
||||||
$(PREFIX) $(COMPILERNAME) $(COMPILE) -c prec.f90 $(SUFFIX)
|
$(PREFIX) $(COMPILERNAME) $(COMPILE) -c prec.f90 $(SUFFIX)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.o : %.f90
|
%.o : %.f90
|
|
@ -0,0 +1,16 @@
|
||||||
|
module HDF5_io
|
||||||
|
use prec
|
||||||
|
use IO
|
||||||
|
use hdf5
|
||||||
|
|
||||||
|
contains
|
||||||
|
|
||||||
|
subroutine HDF5_init(filename, total_inc, total_time)
|
||||||
|
integer(pInt), intent(in) :: total_inc
|
||||||
|
real(pReal), intent(in) :: total_time
|
||||||
|
|
||||||
|
write(6,*) 'pretend to write something'
|
||||||
|
|
||||||
|
end subroutine HDF5_init
|
||||||
|
|
||||||
|
end module HDF5_io
|
|
@ -0,0 +1,8 @@
|
||||||
|
!COMPILER-GENERATED INTERFACE MODULE: Wed Apr 20 11:10:29 2016
|
||||||
|
MODULE QUIT__genmod
|
||||||
|
INTERFACE
|
||||||
|
SUBROUTINE QUIT(STOP_ID)
|
||||||
|
INTEGER(KIND=4), INTENT(IN) :: STOP_ID
|
||||||
|
END SUBROUTINE QUIT
|
||||||
|
END INTERFACE
|
||||||
|
END MODULE QUIT__genmod
|
Loading…
Reference in New Issue