Skip to content

Commit

Permalink
ALaDyn v2 (#26)
Browse files Browse the repository at this point in the history
* add option for bunch particle in a tensorial way, plus a rediegned and simplified bunch namelist
* Added new diagnostics for ionized bunch
* Fixed string length in particle output
* Added diagnostic for ionized particles
* Fixed number of parameter in subroutine en_data
* add decomposition of the seventh component to flag particles: now the seventh component is written as mass+charge+flag, where the last input (flag) is an integer to track particles
* Enabled flag for complex envelope output
* remove seventh component splitting with the subroutine approach
* add sigma_cut_bunch to the counting subroutine
* update copyright year
* import tracking, update other routines, fix bugs
* building progress
* bump version
* Enabled real and imaginary output for envelope
* wgh_cmp order correction for weighted bunch option
* fixing weighted diagnostics and adding overflow flag
* Added cmake script for Edison
* Fixed major issues in particle tracking
* minor fixes for tracking and beam dump data
* Fixed minor types mismatch
* Added check on track_aux allocation in particle tracking
* Refined check on track_aux
* add support channels to readme
* Updated Namelist guide
* add some cmake script to build with debug
* Updated build scripts for Edison
* update marconi scripts
* Updated lwfa example
* small updates, resync with upstream
* set q-q spline for a smoother evolution
* clean up toolchain files, force not using MKL
* force static fftw on edison
* rewrite FindFFTW.cmake in a more modern way
* remove leftovers
* Fixed laser intensity and tracking
* remove wrong fft calls
* fix mkl loading in scripts and compilation
* add gnu scripts for knl (beta)
* Fixed interpolation problem in envelope
* Minor updates for Hybrid model
* Code cleaning for jb_norm definition
* Fixed envelope static window and fixed envelope energy output
* Fixed major problems in the envelope particle pusher
* rework indentation to unify code style
* add build instructions
  • Loading branch information
albz authored and cenit committed Mar 11, 2018
1 parent 405cda5 commit fa768fc
Show file tree
Hide file tree
Showing 80 changed files with 12,726 additions and 9,875 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -41,13 +41,15 @@ opt_report.txt
[Bb]in/
.vs/
.vscode/
*.Rapp.history
log.*

cmake.*
make.*
!/scripts/build/cmake.*
!/scripts/build/make.*
build.*

.project
*.nml
index.md

17 changes: 5 additions & 12 deletions .travis.yml
Expand Up @@ -4,25 +4,19 @@ os:
- linux
- osx

compiler:
compiler:
- gcc

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:boost-latest/ppa'
packages:
- gfortran
- gcc
- g++
- libopenmpi-dev
- libboost-all-dev
- libfftw3-dev
- cmake

before_install:
# OSX Setup
# OSX Setup
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew cask uninstall oclint ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install gcc ;fi
Expand All @@ -37,8 +31,8 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CXX=/usr/local/bin/g++-7 ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_Fortran_COMPILER=$FC ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_C_COMPILER=$CC ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_CXX_COMPILER=$CXX ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_LINKER=clang++ ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_CXX_COMPILER=$CXX ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export CMAKE_LINKER=clang++ ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OMPI_MPICXX=$CXX ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OMPI_CXX=$CXX ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OMPI_MPICC=$CC ;fi
Expand All @@ -48,7 +42,7 @@ install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OMPI_MPIF77=$FC ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export OMPI_F77=$FC ;fi

# Linux Setup
# Linux Setup
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CXX="/usr/bin/g++" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export CC="/usr/bin/gcc" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export FC="/usr/bin/gfortran" ;fi
Expand All @@ -63,4 +57,3 @@ install:

script:
- mkdir build && cd build && cmake .. && cmake --build . --target install

213 changes: 112 additions & 101 deletions CMakeLists.txt
Expand Up @@ -5,138 +5,149 @@ enable_language(CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

# uncomment the following definition to enable GDB attach to debug while running
# add_definitions(-DENABLE_GDB_ATTACH)

# you can force FFTW if necessary, avoiding MKL (which is preferred on Intel systems)
set(FORCE_FFTW OFF CACHE BOOL "Forcing FFTW libraries")

if (FORCE_FFTW)
message(STATUS "Forcing FFTW, avoid MKL even if found")
else()
message(STATUS "MKL is preferred to FFTW, if found")
endif()

# set this variable to true to force static linking (if supported by the compiler)
set(FORCE_STATIC_LINK FALSE CACHE BOOL "Forcing static linking to libraries")

# make sure that the default is a RELEASE
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()


get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME)
if (Fortran_COMPILER_NAME MATCHES "gfortran*")
string(APPEND CMAKE_CXX_COMPILE_FLAGS " -Wall")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -fdefault-real-8")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -fdefault-real-8 -Wall -Wextra")
if (MARCONI_KNL)
set (CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} -mavx512f -mavx512cd -mavx512er -mavx512pf")
set (CMAKE_Fortran_FLAGS_RELEASE "-fdefault-real-8 -funroll-all-loops -mavx512f -mavx512cd -mavx512er -mavx512pf -O3")
set (CMAKE_Fortran_FLAGS_DEBUG "-fdefault-real-8 -Wall -Wextra -fbacktrace -fbounds-check -mavx512f -mavx512cd -mavx512er -mavx512pf -Og -g")
string(APPEND CMAKE_CXX_COMPILE_FLAGS " -mavx512f -mavx512cd -mavx512er -mavx512pf")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -funroll-all-loops -mavx512f -mavx512cd -mavx512er -mavx512pf -O3")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -fbacktrace -fbounds-check -mavx512f -mavx512cd -mavx512er -mavx512pf -Og -g")
else()
set (CMAKE_Fortran_FLAGS_RELEASE "-fdefault-real-8 -funroll-all-loops -O3")
set (CMAKE_Fortran_FLAGS_DEBUG "-fdefault-real-8 -Wall -Wextra -fbacktrace -fbounds-check -Og -g")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -funroll-all-loops -O3")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -fbacktrace -fbounds-check -Og -g")
endif()
elseif (Fortran_COMPILER_NAME MATCHES "ifort*")
elseif (Fortran_COMPILER_NAME MATCHES "ifort*" OR Fortran_COMPILER_NAME MATCHES "ftn*")
set(USING_INTEL_COMPILER TRUE)
string(APPEND CMAKE_CXX_COMPILE_FLAGS " -diag-enable warn")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -real-size 64")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -real-size 64 -diag-enable warn")
if (MARCONI_KNL)
set (CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} -xMIC-AVX512")
set (CMAKE_Fortran_FLAGS_RELEASE "-real-size 64 -xMIC-AVX512 -O3")
set (CMAKE_Fortran_FLAGS_DEBUG "-real-size 64 -xMIC-AVX512 -check all -fpe0 -warn -traceback -debug extended -O0 -g")
set (CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS} -lstdc++")
string(APPEND CMAKE_CXX_COMPILE_FLAGS " -xMIC-AVX512")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -xMIC-AVX512 -O3")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -xMIC-AVX512 -check all -fpe0 -warn -traceback -debug extended -O0 -g")
string(APPEND CMAKE_Fortran_LINK_FLAGS " -lstdc++")
if (NOT FORCE_FFTW)
string(APPEND CMAKE_Fortran_LINK_FLAGS " -mkl")
endif()
else()
set (CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} -axcore-avx-i,SSE4.2")
set (CMAKE_Fortran_FLAGS_RELEASE "-real-size 64 -axcore-avx-i,SSE4.2 -O3")
set (CMAKE_Fortran_FLAGS_DEBUG "-real-size 64 -check all -fpe0 -warn -traceback -debug extended -O0 -g")
set (CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS} -lstdc++")
string(APPEND CMAKE_CXX_COMPILE_FLAGS " -axcore-avx-i,SSE4.2")
string(APPEND CMAKE_Fortran_FLAGS_RELEASE " -axcore-avx-i,SSE4.2 -O3")
string(APPEND CMAKE_Fortran_FLAGS_DEBUG " -check all -fpe0 -warn -traceback -debug extended -O0 -g")
string(APPEND CMAKE_Fortran_LINK_FLAGS " -lstdc++")
if (NOT FORCE_FFTW)
string(APPEND CMAKE_Fortran_LINK_FLAGS " -mkl")
endif()
endif()
else ()
if (MARCONI_KNL)
error ("Unsupported compiler for KNL")
else()
message ("CMAKE_Fortran_COMPILER found but unsupported")
message ("Let's try using it...")
set (CMAKE_Fortran_FLAGS_RELEASE "-O3")
set (CMAKE_Fortran_FLAGS_DEBUG "-O0 -g")
endif ()
endif ()


if(FORCE_STATIC_LINK)
string(APPEND CMAKE_Fortran_LINK_FLAGS " -static")
endif()

find_package(Boost COMPONENTS system filesystem REQUIRED)
find_package(MPI REQUIRED)
find_package(MKL)
if(NOT MKL_FOUND)
find_package(FFTW)
endif()
if(NOT FFTW_FOUND AND NOT MKL_FOUND)
message(FATAL_ERROR "FFTW and MKL not found, unable to build")
endif()

# make sure that the default is a RELEASE
set(default_build_type "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE
STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
if (USING_INTEL_COMPILER AND NOT FORCE_FFTW)
find_package(MKL REQUIRED)
set(MKL_FFTW_INCLUDE_DIR "${MKL_INCLUDE_DIR}/fftw/")
else()
find_package(FFTW REQUIRED)
endif()

set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS}")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} ${MPI_LINK_FLAGS}")
set(CMAKE_Fortran_COMPILE_FLAGS "${CMAKE_Fortran_COMPILE_FLAGS} ${MPI_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}")
set(CMAKE_Fortran_LINK_FLAGS "${CMAKE_Fortran_LINK_FLAGS} ${MPI_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}")
string(APPEND CMAKE_CXX_COMPILE_FLAGS " ${MPI_COMPILE_FLAGS}")
string(APPEND CMAKE_CXX_LINK_FLAGS " ${MPI_LINK_FLAGS}")
string(APPEND CMAKE_Fortran_COMPILE_FLAGS " ${MPI_COMPILE_FLAGS} ${MPI_Fortran_COMPILE_FLAGS}")
string(APPEND CMAKE_Fortran_LINK_FLAGS " ${MPI_LINK_FLAGS} ${MPI_Fortran_LINK_FLAGS}")

include_directories(${OTHER_INCLUDE_DIR} ${MPI_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${FFTW_INCLUDES} ${MKL_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
include_directories(${OTHER_INCLUDE_DIR} ${MPI_INCLUDE_PATH} ${MPI_Fortran_INCLUDE_PATH} ${FFTW_INCLUDE_DIR} ${MKL_INCLUDE_DIR} ${MKL_FFTW_INCLUDE_DIR} ${Boost_INCLUDE_DIR})
link_directories(${OTHER_LINK_DIR})

add_executable (ALaDyn
src/ALaDyn.F90
src/precision_def.F90
src/mpi_var.f90
src/phys_param.f90
src/grid_and_particles.f90
src/code_util.f90
src/system_utilities.f90
src/util.f90
src/fft_lib.F90
src/struct_def.f90
src/grid_param.f90
src/control_bunch_input.f90
src/ionize.f90
src/pstruct_data.F90
src/fstruct_data.f90
src/all_param.f90
src/particles.F90
src/parallel.F90
src/pic_rutil.f90
src/der_lib.f90
src/grid_fields.f90
src/pdf_moments.f90
src/pic_in.f90
src/pic_out.f90
src/pic_dump.f90
src/pic_evolve_in_time.f90
src/pwfa_bunch_field_calculation.F90
src/read_input.f90
src/pwfa_output_addons.f90
add_executable (ALaDyn
src/ALaDyn.F90
src/precision_def.F90
src/mpi_var.f90
src/phys_param.f90
src/grid_and_particles.f90
src/code_util.f90
src/system_utilities.f90
src/util.f90
src/fft_lib.F90
src/struct_def.f90
src/grid_param.f90
src/control_bunch_input.f90
src/ionz_data.f90
src/ionize.f90
src/pstruct_data.F90
src/fstruct_data.f90
src/psolv.f90
src/all_param.f90
src/particles.F90
src/parallel.F90
src/pic_rutil.f90
src/der_lib.f90
src/grid_fields.f90
src/pdf_moments.f90
src/pic_in.f90
src/pic_out.f90
src/pic_out_util.f90
src/pic_dump.f90
src/pic_evolve_in_time.f90
src/pwfa_bunch_field_calculation.F90
src/read_input.f90
src/pwfa_output_addons.f90
)

add_library(cpp_folder_tree STATIC src/cpp_folder_tree.cpp)
add_library(find_last_addr STATIC src/find_last_addr.cpp)
add_library(enable_gdb_attach STATIC src/enable_gdb_attach.cpp)

target_link_libraries(ALaDyn
cpp_folder_tree
find_last_addr
enable_gdb_attach
${MPI_Fortran_LIBRARIES}
${MPI_LIBRARIES}
${Boost_LIBRARIES}
)
target_link_libraries(ALaDyn
cpp_folder_tree
find_last_addr
enable_gdb_attach
${MPI_Fortran_LIBRARIES}
${MPI_LIBRARIES}
${Boost_LIBRARIES}
)

if(MKL_FOUND)
target_link_libraries(ALaDyn
${MKL_LIBRARIES}
)
else()
target_link_libraries(ALaDyn
${FFTW_LIBRARIES}
)
if (NOT USING_INTEL_COMPILER OR FORCE_FFTW)
target_link_libraries(ALaDyn ${FFTW_LIBRARY})
endif()


#set_target_properties(ALaDyn PROPERTIES HAS_Fortran TRUE LINKER_LANGUAGE CXX)
#set_target_properties(ALaDyn PROPERTIES HAS_CXX TRUE LINKER_LANGUAGE Fortran)
set_target_properties(ALaDyn PROPERTIES LINKER_LANGUAGE Fortran)

install (TARGETS ALaDyn DESTINATION ${CMAKE_SOURCE_DIR}/bin/)

add_library(cpp_folder_tree STATIC src/cpp_folder_tree.cpp)
#set_target_properties(cpp_folder_tree PROPERTIES HAS_CXX TRUE)
#set_property(TARGET ${cpp_folder_tree} PROPERTY LINKER_LANGUAGE CXX)

add_library(find_last_addr STATIC src/find_last_addr.cpp)
#set_target_properties(find_last_addr PROPERTIES HAS_CXX TRUE)
#set_property(TARGET ${find_last_addr} PROPERTY LINKER_LANGUAGE CXX)

add_library(enable_gdb_attach STATIC src/enable_gdb_attach.cpp)
#set_target_properties(enable_gdb_attach PROPERTIES HAS_CXX TRUE)
#set_property(TARGET ${enable_gdb_attach} PROPERTY LINKER_LANGUAGE CXX)


55 changes: 0 additions & 55 deletions LICENSE.txt
Expand Up @@ -617,58 +617,3 @@ reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

END OF TERMS AND CONDITIONS

How to Apply These Terms to Your New Programs

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

0 comments on commit fa768fc

Please sign in to comment.