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

Integration branch SixTrackLib 0.7.0 #137

Open
wants to merge 80 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3b5b9a0
sixtracklib/common: fixes type inconsistency
martinschwinzerl Nov 10, 2020
deecca1
cmake: bumps minimum required cmake version to 3.11
martinschwinzerl Nov 25, 2020
8438311
cmake: updates OpenCL setup script
martinschwinzerl Nov 25, 2020
63fd9c8
sixtracklib/opencl: updates wrapper headers to manage new OpenCL 3.x …
martinschwinzerl Nov 25, 2020
04c7bf9
sixtracklib: uses new opencl wrapper headers in sixtracklib.h and six…
martinschwinzerl Nov 25, 2020
23d59eb
sixtracklib/opencl: uses new OpenCL wrapper headers in module
martinschwinzerl Nov 25, 2020
5324f9f
examples: use common compiler flags for C99 and C++ examples
martinschwinzerl Nov 25, 2020
c6fc501
tests/sixtracklib/opencl: uses common compiler flags for OpenCL tests
martinschwinzerl Nov 25, 2020
9827bc8
external/CL: updates fallback opencl headers
martinschwinzerl Nov 25, 2020
36aaa59
tests/sixtracklib/opencl: updates wrapper include header in OpenCL test
martinschwinzerl Nov 25, 2020
066015d
Merge remote-tracking branch 'mschwinz/bugfix/133_inconsistent_int' i…
martinschwinzerl Nov 25, 2020
e6fcc21
cmake: debugs issues with OpenCL setup in cmake
martinschwinzerl Nov 25, 2020
0e6992a
sixtracklib/opencl: fixes superflous type alias
martinschwinzerl Nov 25, 2020
129b5ee
sixtracklib/opencl: fixes type alias issue
martinschwinzerl Nov 25, 2020
f7c6ca4
sixtracklib/opencl: fixes type alias issue
martinschwinzerl Nov 25, 2020
b16b0d5
tools: fixes inconsistent compiler flags for compiling the tools
martinschwinzerl Nov 25, 2020
1000443
sixtracklib/testlib: fixes type inconsistent print formats
martinschwinzerl Nov 25, 2020
dc9a9a1
sixtracklib/testlib: fixes type inconsistent print formats
martinschwinzerl Nov 25, 2020
81ca1c8
Merge branch 'feature/pr137_sixtracklib_070' of github.com:martinschw…
martinschwinzerl Nov 25, 2020
4094799
sixtracklib: fixes issue with missing transient OpenCL include path
martinschwinzerl Nov 25, 2020
e6598c0
cmake: removes non-necessary prints from SetupOpenCL; cosmetic fixes
martinschwinzerl Nov 25, 2020
d897082
sixtracklib/opencl: adds missing CL_TARGET_OPENCL_VERSION macro to op…
martinschwinzerl Nov 25, 2020
7fadab9
tools: fixes inconsistent print type codes
martinschwinzerl Nov 25, 2020
7500ef7
examples/c99: fixes inconsistent type format statements in printf
martinschwinzerl Nov 25, 2020
aa9271b
tools: fixes inconsistent type format statements in printf
martinschwinzerl Nov 25, 2020
cb5852e
examples/c99: fixes inconsistent type format statements in printf
martinschwinzerl Nov 25, 2020
26afb35
tools: fixes inconsistent type format statements in printf
martinschwinzerl Nov 25, 2020
60b29fc
Settings.cmake: add option to always download latest OpenCL headers
martinschwinzerl Nov 25, 2020
bc2b4a8
cmake: updates SetupOpenCL.cmake
martinschwinzerl Nov 25, 2020
c395684
sixtracklib/opencl: suppresses pedantic warnings when using the OpenC…
martinschwinzerl Nov 25, 2020
1130163
sixtracklib/opencl: encodes whether the headers have been downloaded …
martinschwinzerl Nov 25, 2020
8a359b6
python: adds scipy requirement to setup.py
martinschwinzerl Nov 25, 2020
0bc76c9
cmake: clarifies conditions for downloading headers
martinschwinzerl Nov 25, 2020
138f09d
python: fixes wrong version number
martinschwinzerl Nov 26, 2020
266465f
tests/testlib: adds init functions for testcases
martinschwinzerl Nov 26, 2020
794f758
examples/cxx: adds example for tracking the same FODO lattice as simp…
martinschwinzerl Nov 26, 2020
6ccacdb
examples/cxx: fixes timing track_fodod_opencl_cxx
martinschwinzerl Nov 26, 2020
d29cad6
examples/cxx: adds tracking example for cuda
martinschwinzerl Nov 26, 2020
8cf0ef5
examples/cxx: fixes initialisation issue with cuda example
martinschwinzerl Nov 26, 2020
882ed8f
examples/c99: fix synchronisation issue in the track fodo example
martinschwinzerl Nov 26, 2020
2b02f72
examples/cxx: fixes copy & paste errors in the cuda track fodo example
martinschwinzerl Nov 26, 2020
1d132ac
examples/c99: fix synchronisation issue in the track fodo example
martinschwinzerl Nov 26, 2020
5fd2c16
Merge branch 'feature/pr137_sixtracklib_070' of github.com:martinschw…
martinschwinzerl Nov 26, 2020
7f56689
cmake: adds option to Settings.cmake to control output of OpenCL comp…
martinschwinzerl Dec 2, 2020
b9874bf
cmake: adds handling for print build report to OpenCL setup
martinschwinzerl Dec 2, 2020
7251051
sixtracklib/opencl: adds handling for printing build report for OpenC…
martinschwinzerl Dec 2, 2020
7471877
sixtracklib/opencl: adds helper functions to handle the build report
martinschwinzerl Dec 2, 2020
35abfd0
sixtracklib/opencl: fixes exception handling issue due to changed mac…
martinschwinzerl Dec 2, 2020
2e531c7
sixtracklib/opencl: adds OpenCL build report handlng to install target
martinschwinzerl Dec 2, 2020
98b79a9
sixtraclib/opencl: adds output for the Compile Options
martinschwinzerl Dec 2, 2020
b946a6b
common: adds new mathematical constants
martinschwinzerl Sep 3, 2021
4444917
common: increases number of sig. digits for pi, removes duplicate ent…
martinschwinzerl Sep 3, 2021
f2855cb
common: completes API for new and updated mathematical constants
martinschwinzerl Sep 3, 2021
8c52151
common: fixes issues with the factorial methods
martinschwinzerl Sep 3, 2021
6978fb8
common: adds sincos method and provides fallback if not available
martinschwinzerl Sep 3, 2021
9999c81
common: updates NS(pow_int_exp)
martinschwinzerl Sep 3, 2021
6716fb9
common: adds NS(round), NS(floor), and NS(ceil) to the mathematical m…
martinschwinzerl Sep 3, 2021
98db7d8
common: adds decorator for (private memory) results
martinschwinzerl Sep 3, 2021
c09f3ed
common: updates faddeeva implementations
martinschwinzerl Sep 3, 2021
43cc321
common: updates calls to the faddeeva function to work with new conve…
martinschwinzerl Sep 3, 2021
9ef45dc
common: adds symbols in shared library for faddeeva related methods
martinschwinzerl Sep 3, 2021
eb409cb
common: adds all parameters controlling faddeeva as preprocessor macros
martinschwinzerl Sep 3, 2021
fc10ea2
common: adds dawson approximation for faddeeva with small imaginary a…
martinschwinzerl Sep 3, 2021
c411c9b
common: adds precomputed and tabulated value for the Abrarov & Quine …
martinschwinzerl Sep 3, 2021
8413fa7
common: enables building new faddeeva implementation
martinschwinzerl Sep 3, 2021
8e48346
opencl: adds helpers
martinschwinzerl Sep 3, 2021
52e7a23
sixtracklib: adds new headers for faddeeva implementation
martinschwinzerl Sep 3, 2021
a02f581
tests/python: adds unit tests for faddeeva implementation
martinschwinzerl Sep 4, 2021
680c115
tests/python: enable beamfields test
martinschwinzerl Sep 4, 2021
9cc9931
common: fixes bugs and inconsistencies for Faddeeva implementation
martinschwinzerl Sep 4, 2021
bf811dd
python: adds bindings for the faddeeva and dawson methods
martinschwinzerl Sep 4, 2021
69ee3ec
common: fixes bugs in Alg680 Faddeeva implementation
martinschwinzerl Sep 4, 2021
c0992c6
tests/python: removes duplicate test name
martinschwinzerl Sep 4, 2021
a85db18
common: fixes algorithm 680 related constants
martinschwinzerl Sep 4, 2021
3b7fbe1
common: adds faddeeva implementation
martinschwinzerl Sep 5, 2021
1af93f8
common: adds config options for fixed cernlib method
martinschwinzerl Sep 5, 2021
9713926
common: adds symbols for pre-configured faddeeva methods
martinschwinzerl Sep 5, 2021
dca9161
python: adds symbols for additional faddeeva specialisation to python
martinschwinzerl Sep 5, 2021
4c7c6b8
tests/python: adds unit-test for fixed cernlib implementation
martinschwinzerl Sep 5, 2021
929c7a2
tests/python: renders test for algorithm 680 stricter
martinschwinzerl Sep 5, 2021
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# granted to it by virtue of its status as an Intergovernmental Organization or
# submit itself to any jurisdiction.

cmake_minimum_required( VERSION 3.8 FATAL_ERROR )
cmake_minimum_required( VERSION 3.11 FATAL_ERROR )
project( sixtracklib LANGUAGES C CXX )

message( STATUS "---- Project sixtracklib" )
Expand Down
10 changes: 9 additions & 1 deletion Settings.cmake.default
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,18 @@ if( SIXTRACKL_ENABLE_OPENCL )
set( SIXTRACKL_TARGET_OPENCL_VERSION "120" CACHE STRING
"Target OpenCL 1.x version" )

option( SIXTRACKL_USE_LEGACY_CL_HPP "Use legacy cl.hpp header" OFF )
option( SIXTRACKL_USE_LEGACY_CL_HPP
"Use legacy cl.hpp header [DEPRECATED!]" OFF )

option( SIXTRACKL_OPENCL_ALWAYS_DOWNLOAD_HEADERS
"Always try to download latest stable OpenCL headers" OFF )

option( SIXTRACKL_OPENCL_CXX_ENABLE_EXCEPTIONS
"Enable OpenCL 1.x Host-side C++ Exceptions" ON )

set( SIXTRACKL_OPENCL_PRINT_BUILD_REPORT "error" CACHE STRING
"print OpenCL build report [values: always, error, never]" )

endif()

# ------------------------------------------------------------------------------
Expand Down
408 changes: 249 additions & 159 deletions cmake/SetupOpenCL.cmake

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions examples/c99/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,13 @@ set( ALL_EXAMPLE_TARGETS
${EXAMPLE_TARGETS} ${EXAMPLE_OPENCL_TARGETS} ${EXAMPLE_CUDA_TARGETS} )

if( ALL_EXAMPLE_TARGETS )
set( EXAMPLE_COMPILE_OPTIONS ${SIXTRACKLIB_CPU_FLAGS} )
list( APPEND EXAMPLE_COMPILE_OPTIONS -Wall )
list( APPEND EXAMPLE_COMPILE_OPTIONS -Werror )
list( APPEND EXAMPLE_COMPILE_OPTIONS -pedantic )

set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY LINKER_LANGUAGE C )
set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY C_STANDARD 99 )
set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY C_STANDARD_REQUIRED ON )
set_property( TARGET ${ALL_EXAMPLE_TARGETS}
APPEND PROPERTY COMPILE_OPTIONS ${EXAMPLE_COMPILE_OPTIONS} )
APPEND PROPERTY COMPILE_OPTIONS
${SIXTRACKLIB_CPU_FLAGS} ${SIXTRACKLIB_C99_FLAGS}
${SIXTRACKL_C99_AUTOVEC_FLAGS} )

set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY
LINK_LIBRARIES ${EXAMPLE_LINK_LIBRARIES} )
Expand Down
6 changes: 4 additions & 2 deletions examples/c99/simple_particles_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ int main( int argc, char* argv[] )
)st_Object_get_const_begin_ptr( cmp_obj_it );

printf( "particle blocks: %3lu / %3lu\r\n",
ii, num_particles_blocks );
( unsigned long )ii,
( unsigned long )num_particles_blocks );

printf( " -> original particles object : \r\n" );
printParticles( cmp_particles );
Expand Down Expand Up @@ -148,7 +149,8 @@ int main( int argc, char* argv[] )
)st_Object_get_const_begin_ptr( obj_it );

printf( "managed buffer particle blocks: %3lu / %3lu\r\n",
ii, num_particles_blocks );
( unsigned long )ii,
( unsigned long )num_particles_blocks );

printf( " -> copy particles object : \r\n" );
printParticles( particles );
Expand Down
3 changes: 2 additions & 1 deletion examples/c99/track_bbsimple.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ int main( int argc, char* argv[] )
}

printf( "Use: NUM_PARTICLES = %10lu\r\n"
" NUM_TURNS = %10lu\r\n\r\n", NUM_PARTICLES, NUM_TURNS );
" NUM_TURNS = %10lu\r\n\r\n",
( unsigned long )NUM_PARTICLES, ( unsigned long )NUM_TURNS );

/* ********************************************************************** */
/* **** Building Particles Data from Input Example Particle Data **** */
Expand Down
3 changes: 2 additions & 1 deletion examples/c99/track_beambeam.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ int main( int argc, char* argv[] )
}

printf( "Use: NUM_PARTICLES = %10lu\r\n"
" NUM_TURNS = %10lu\r\n\r\n", NUM_PARTICLES, NUM_TURNS );
" NUM_TURNS = %10lu\r\n\r\n",
( unsigned long )NUM_PARTICLES, ( unsigned long )NUM_TURNS );

/* ********************************************************************** */
/* **** Building Particles Data from Input Example Particle Data **** */
Expand Down
2 changes: 1 addition & 1 deletion examples/c99/track_lhc_bb.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main( int argc, char* argv[] )

printf( "Selected NUM_PARTICLES = %10lu\r\n"
"Selected NUM_TURNS = %10lu\r\n"
"\r\n", NUM_PARTICLES, NUM_TURNS );
"\r\n", ( unsigned long )NUM_PARTICLES, ( unsigned long )NUM_TURNS );

/* ********************************************************************** */
/* **** Building Particles Data from LHC Particle Dump Data **** */
Expand Down
2 changes: 1 addition & 1 deletion examples/c99/track_lhc_no_bb.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ int main( int argc, char* argv[] )

printf( "Selected NUM_PARTICLES = %10lu\r\n"
"Selected NUM_TURNS = %10lu\r\n"
"\r\n", NUM_PARTICLES, NUM_TURNS );
"\r\n", ( unsigned long )NUM_PARTICLES, ( unsigned long )NUM_TURNS );

/* ********************************************************************** */
/* **** Building Particles Data from LHC Particle Dump Data **** */
Expand Down
22 changes: 13 additions & 9 deletions examples/cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,18 @@ if( SIXTRACKL_ENABLE_OPENCL )
add_executable( track_lhc_no_bb_opencl_cxx track_lhc_no_bb_opencl.cpp )
list( APPEND EXAMPLE_OPENCL_TARGETS track_lhc_no_bb_opencl_cxx )

# -------------------------------------------------------------------------
# track_fodo_opencl_cxx:
add_executable( track_fodo_opencl_cxx track_fodo_opencl.cpp )
list( APPEND EXAMPLE_OPENCL_TARGETS track_fodo_opencl_cxx )

endif()

if( SIXTRACKL_ENABLE_CUDA )
# -------------------------------------------------------------------------
# track_fodo_opencl_cxx:
add_executable( track_fodo_cuda_cxx track_fodo_cuda.cpp )
list( APPEND EXAMPLE_CUDA_TARGETS track_fodo_cuda_cxx )
endif()

# ==============================================================================
Expand All @@ -55,17 +66,12 @@ set( ALL_EXAMPLE_TARGETS
${EXAMPLE_TARGETS} ${EXAMPLE_OPENCL_TARGETS} ${EXAMPLE_CUDA_TARGETS} )

if( ALL_EXAMPLE_TARGETS )

set( EXAMPLE_COMPILE_OPTIONS ${SIXTRACKLIB_CPU_FLAGS} )
list( APPEND EXAMPLE_COMPILE_OPTIONS -Wall )
list( APPEND EXAMPLE_COMPILE_OPTIONS -Werror )
list( APPEND EXAMPLE_COMPILE_OPTIONS -pedantic )

set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY LINKER_LANGUAGE CXX )
set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY CXX_STANDARD 11 )
set_property( TARGET ${ALL_EXAMPLE_TARGETS} PROPERTY CXX_STANDARD_REQUIRED ON )
set_property( TARGET ${ALL_EXAMPLE_TARGETS}
APPEND PROPERTY COMPILE_OPTIONS ${EXAMPLE_COMPILE_OPTIONS} )
APPEND PROPERTY COMPILE_OPTIONS ${SIXTRACKLIB_CPU_FLAGS}
${SIXTRACKLIB_CXX_FLAGS} ${SIXTRACKL_CXX_AUTOVEC_FLAGS} )

set_property( TARGET ${ALL_EXAMPLE_TARGETS}
PROPERTY LINK_LIBRARIES ${EXAMPLE_LINK_LIBRARIES} )
Expand Down Expand Up @@ -186,5 +192,3 @@ if( SIXTRACKL_INSTALL_EXAMPLES AND ALL_EXAMPLE_TARGETS )
configure_file( \"${CMAKELISTS_TXT_IN_PATH}\"
\"${CMAKELISTS_TXT_INSTALL_PATH}\" ESCAPE_QUOTES @ONLY )" )
endif()

# end: examples/cxx/CMakeLists.txt
74 changes: 74 additions & 0 deletions examples/cxx/track_fodo_cuda.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include <cmath>
#include <chrono>
#include <iostream>
#include <numeric>
#include <string>

#include "sixtracklib/testlib.h"
#include "sixtracklib/sixtracklib.hpp"

int main( int const argc, char* argv[] )
{
namespace st = sixtrack;
using std::sqrt;
using track_job_type = st::CudaTrackJob;

unsigned int NUM_PARTICLES = 50000; // Default
unsigned int NUM_TURNS = 10000; // Default
std::string const device_id = "0.0";

double const Q0 = 1.0;
double const MASS0 = ( double )SIXTRL_PHYS_CONST_MASS_PROTON_EV;
double const P0_C = 450.0e9;
double const MIN_X = 0.0;
double const MAX_X = 1e-8;
double const CHI = 1.0;
double const CHARGE_RATIO = 1.0;

if( argc == 1 )
{
std::cout << "Usage: " << argv[ 0 ]
<< " num_particles=" << NUM_PARTICLES
<< " num_turns=" << NUM_TURNS << std::endl;
}

if( argc >= 2 )
{
NUM_PARTICLES = std::stoi( argv[ 1 ] );

if( argc >= 3 )
{
NUM_TURNS = std::stoi( argv[ 2 ] );
}
}

/* ---------------------------------------------------------------------- */
/* Build lattice */

st::Buffer lattice;
::NS(TrackTestdata_generate_fodo_lattice)( lattice.getCApiPtr(), NUM_TURNS );

/* ---------------------------------------------------------------------- */
/* Init particle distribution */

st::Buffer pbuffer;
::NS(TrackTestdata_generate_particle_distr_x)( pbuffer.getCApiPtr(),
NUM_PARTICLES, P0_C, MIN_X, MAX_X, MASS0, Q0, CHI, CHARGE_RATIO );

/* ---------------------------------------------------------------------- */
/* Create Track Job */

track_job_type job( device_id, pbuffer, lattice );
auto start_time = std::chrono::steady_clock::now();
job.trackUntil( NUM_TURNS );
st::collect( job );
auto stop_time = std::chrono::steady_clock::now();

std::chrono::duration< double > const wtime = stop_time - start_time;

std::cout << "elapsed wall time: " << wtime.count() << " sec\r\n"
<< " = " << wtime.count() / ( NUM_PARTICLES * NUM_TURNS )
<< " sec/particles/turn" << std::endl;

return 0;
}
80 changes: 80 additions & 0 deletions examples/cxx/track_fodo_opencl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#include <cmath>
#include <chrono>
#include <iostream>
#include <numeric>
#include <string>

#include "sixtracklib/testlib.h"
#include "sixtracklib/sixtracklib.hpp"

int main( int const argc, char* argv[] )
{
namespace st = sixtrack;
using std::sqrt;
using track_job_type = st::TrackJobCl;

unsigned int NUM_PARTICLES = 50000; // Default
unsigned int NUM_TURNS = 10000; // Default
std::string device_id = "0:0";

double const Q0 = 1.0;
double const MASS0 = ( double )SIXTRL_PHYS_CONST_MASS_PROTON_EV;
double const P0_C = 450.0e9;
double const MIN_X = 0.0;
double const MAX_X = 1e-8;
double const CHI = 1.0;
double const CHARGE_RATIO = 1.0;

if( argc == 1 )
{
std::cout << "Usage: " << argv[ 0 ]
<< "device_id=" << device_id
<< " num_particles=" << NUM_PARTICLES
<< " num_turns=" << NUM_TURNS << std::endl;
}

if( argc >= 2 )
{
device_id = std::string{ argv[ 1 ] };

if( argc >= 3 )
{
NUM_PARTICLES = std::stoi( argv[ 2 ] );

if( argc >= 4 )
{
NUM_TURNS = std::stoi( argv[ 3 ] );
}
}
}

/* ---------------------------------------------------------------------- */
/* Build lattice */

st::Buffer lattice;
::NS(TrackTestdata_generate_fodo_lattice)( lattice.getCApiPtr(), NUM_TURNS );

/* ---------------------------------------------------------------------- */
/* Init particle distribution */

st::Buffer pbuffer;
::NS(TrackTestdata_generate_particle_distr_x)( pbuffer.getCApiPtr(),
NUM_PARTICLES, P0_C, MIN_X, MAX_X, MASS0, Q0, CHI, CHARGE_RATIO );

/* ---------------------------------------------------------------------- */
/* Create Track Job */

track_job_type job( device_id, pbuffer, lattice );
auto start_time = std::chrono::steady_clock::now();
job.track( NUM_TURNS );
st::collect( job );
auto stop_time = std::chrono::steady_clock::now();

std::chrono::duration< double > const wtime = stop_time - start_time;

std::cout << "elapsed wall time: " << wtime.count() << " sec\r\n"
<< " = " << wtime.count() / ( NUM_PARTICLES * NUM_TURNS )
<< " sec/particles/turn" << std::endl;

return 0;
}
Loading