Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit fb713738 authored by adelmann's avatar adelmann :reminder_ribbon:
Browse files

Merge branch 'gpu-compile' into 'master'

GPU compilable

See merge request OPAL/opal-x/src!7
parents a4918dee ff6d5291
No related branches found
No related tags found
No related merge requests found
Showing
with 352 additions and 20 deletions
...@@ -22,6 +22,30 @@ ...@@ -22,6 +22,30 @@
// $Author: fci $ // $Author: fci $
// //
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "AbsBeamline/ElementBase.h" #include "AbsBeamline/ElementBase.h"
#include "Fields/EMField.h" #include "Fields/EMField.h"
#include "OPALTypes.h" #include "OPALTypes.h"
......
...@@ -23,6 +23,29 @@ ...@@ -23,6 +23,29 @@
#include "AbsBeamline/Component.h" #include "AbsBeamline/Component.h"
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
// Class Drift // Class Drift
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
/// Interface for drift space. /// Interface for drift space.
...@@ -70,4 +93,4 @@ inline int Drift::getRequiredNumberOfTimeSteps() const { ...@@ -70,4 +93,4 @@ inline int Drift::getRequiredNumberOfTimeSteps() const {
return 1; return 1;
} }
#endif // CLASSIC_Drift_HH #endif // CLASSIC_Drift_HH
\ No newline at end of file
...@@ -64,8 +64,54 @@ ...@@ -64,8 +64,54 @@
#include "Channels/Channel.h" #include "Channels/Channel.h"
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
const std::map<ElementType, std::string> ElementBase::elementTypeToString_s = { const std::map<ElementType, std::string> ElementBase::elementTypeToString_s = {
{ElementType::ANY, "Any"}, {ElementType::ANY, "Any"},
{ElementType::BEAMLINE, "Beamline"}, {ElementType::BEAMLINE, "Beamline"},
......
...@@ -63,6 +63,29 @@ ...@@ -63,6 +63,29 @@
#ifndef CLASSIC_ElementBase_HH #ifndef CLASSIC_ElementBase_HH
#define CLASSIC_ElementBase_HH #define CLASSIC_ElementBase_HH
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "AbsBeamline/AttributeSet.h" #include "AbsBeamline/AttributeSet.h"
#include "Algorithms/CoordinateSystemTrafo.h" #include "Algorithms/CoordinateSystemTrafo.h"
#include "Algorithms/Quaternion.hpp" #include "Algorithms/Quaternion.hpp"
......
...@@ -23,6 +23,29 @@ ...@@ -23,6 +23,29 @@
#include "BeamlineGeometry/StraightGeometry.h" #include "BeamlineGeometry/StraightGeometry.h"
#include "Fields/BMultipoleField.h" #include "Fields/BMultipoleField.h"
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
class Fieldmap; class Fieldmap;
// Class Multipole // Class Multipole
...@@ -160,4 +183,4 @@ inline size_t Multipole::getMaxSkewComponentIndex() const { ...@@ -160,4 +183,4 @@ inline size_t Multipole::getMaxSkewComponentIndex() const {
return SkewComponents.size(); return SkewComponents.size();
} }
#endif // CLASSIC_Multipole_HH #endif // CLASSIC_Multipole_HH
\ No newline at end of file
...@@ -250,4 +250,4 @@ double MultipoleTBase::getFnDerivS(const std::size_t &n, ...@@ -250,4 +250,4 @@ double MultipoleTBase::getFnDerivS(const std::size_t &n,
deriv += -1. * getFn(n, x, s + 2. * stepSize); deriv += -1. * getFn(n, x, s + 2. * stepSize);
deriv /= 12 * stepSize; deriv /= 12 * stepSize;
return deriv; return deriv;
} }
\ No newline at end of file
...@@ -79,6 +79,30 @@ ...@@ -79,6 +79,30 @@
#include "AbsBeamline/Component.h" #include "AbsBeamline/Component.h"
#include "AbsBeamline/EndFieldModel/Tanh.h" #include "AbsBeamline/EndFieldModel/Tanh.h"
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "Fields/BMultipoleField.h" #include "Fields/BMultipoleField.h"
class MultipoleTBase : public Component { class MultipoleTBase : public Component {
......
...@@ -75,6 +75,29 @@ ...@@ -75,6 +75,29 @@
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "BeamlineGeometry/PlanarArcGeometry.h" #include "BeamlineGeometry/PlanarArcGeometry.h"
#include "AbsBeamline/MultipoleTBase.h" #include "AbsBeamline/MultipoleTBase.h"
#include "AbsBeamline/MultipoleTFunctions/RecursionRelation.h" #include "AbsBeamline/MultipoleTFunctions/RecursionRelation.h"
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <experimental/source_location>
#include <vector> #include <vector>
#include "gsl/gsl_sf_pow_int.h" #include "gsl/gsl_sf_pow_int.h"
#include "MultipoleTCurvedVarRadius.h" #include "MultipoleTCurvedVarRadius.h"
......
...@@ -76,6 +76,31 @@ ...@@ -76,6 +76,31 @@
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
*/ */
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "BeamlineGeometry/VarRadiusGeometry.h" #include "BeamlineGeometry/VarRadiusGeometry.h"
#include "AbsBeamline/MultipoleTBase.h" #include "AbsBeamline/MultipoleTBase.h"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "gsl/gsl_sf_gamma.h" #include "gsl/gsl_sf_gamma.h"
#include "gsl/gsl_sf_pow_int.h" #include "gsl/gsl_sf_pow_int.h"
#include "MultipoleTStraight.h" #include "MultipoleTStraight.h"
......
...@@ -79,6 +79,29 @@ ...@@ -79,6 +79,29 @@
#include "AbsBeamline/MultipoleTBase.h" #include "AbsBeamline/MultipoleTBase.h"
#include <vector> #include <vector>
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
class MultipoleTStraight: public MultipoleTBase { class MultipoleTStraight: public MultipoleTBase {
public: public:
/** Constructor /** Constructor
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
*/ */
#include <cmath> #include <cmath>
#include "AbsBeamline/BeamlineVisitor.h" #include "AbsBeamline/BeamlineVisitor.h"
#include "AbsBeamline/ScalingFFAMagnet.h" #include "AbsBeamline/ScalingFFAMagnet.h"
#include "PartBunch/PartBunch.hpp" #include "PartBunch/PartBunch.hpp"
......
...@@ -30,6 +30,29 @@ ...@@ -30,6 +30,29 @@
#include "AbsBeamline/EndFieldModel/EndFieldModel.h" #include "AbsBeamline/EndFieldModel/EndFieldModel.h"
#include "AbsBeamline/Component.h" #include "AbsBeamline/Component.h"
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#ifndef ABSBEAMLINE_ScalingFFAMagnet_H #ifndef ABSBEAMLINE_ScalingFFAMagnet_H
#define ABSBEAMLINE_ScalingFFAMagnet_H #define ABSBEAMLINE_ScalingFFAMagnet_H
......
...@@ -21,6 +21,29 @@ ...@@ -21,6 +21,29 @@
// //
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "AbsBeamline/Component.h" #include "AbsBeamline/Component.h"
#include "Algorithms/CoordinateSystemTrafo.h" #include "Algorithms/CoordinateSystemTrafo.h"
......
...@@ -22,6 +22,29 @@ ...@@ -22,6 +22,29 @@
#ifndef OPAL_OpalData_HH #ifndef OPAL_OpalData_HH
#define OPAL_OpalData_HH #define OPAL_OpalData_HH
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include <iosfwd> #include <iosfwd>
#include <map> #include <map>
#include <stack> #include <stack>
......
...@@ -279,7 +279,7 @@ void DistributionMoments::computeMoments(ippl::ParticleAttrib<Vector_t<double,3> ...@@ -279,7 +279,7 @@ void DistributionMoments::computeMoments(ippl::ParticleAttrib<Vector_t<double,3>
} }
double betaGamma = std::sqrt(std::pow(meanGamma_m, 2) - 1.0); double betaGamma = std::sqrt(std::pow(meanGamma_m, 2) - 1.0);
geometricEps_m = normalizedEps_m / Vector_t(betaGamma); geometricEps_m = normalizedEps_m / Vector_t<double,3>(betaGamma);
} }
......
...@@ -18,6 +18,29 @@ ...@@ -18,6 +18,29 @@
#ifndef DISTRIBUTIONMOMENTS_H #ifndef DISTRIBUTIONMOMENTS_H
#define DISTRIBUTIONMOMENTS_H #define DISTRIBUTIONMOMENTS_H
#ifdef __CUDACC__
#pragma push_macro("__cpp_consteval")
#pragma push_macro("_NODISCARD")
#pragma push_macro("__builtin_LINE")
#define __cpp_consteval 201811L
#ifdef _NODISCARD
#undef _NODISCARD
#define _NODISCARD
#endif
#define consteval constexpr
#include <source_location>
#undef consteval
#pragma pop_macro("__cpp_consteval")
#pragma pop_macro("_NODISCARD")
#else
#include <source_location>
#endif
#include "Ippl.h" #include "Ippl.h"
#include <Kokkos_Core.hpp> #include <Kokkos_Core.hpp>
#include "Algorithms/BoostMatrix.h" #include "Algorithms/BoostMatrix.h"
...@@ -95,12 +118,12 @@ public: ...@@ -95,12 +118,12 @@ public:
double getTotalMass() const; double getTotalMass() const;
double getTotalNumParticles() const; double getTotalNumParticles() const;
private:
bool isParticleExcluded(const OpalParticle&) const;
void computeMeans(ippl::ParticleAttrib<Vector_t<double,3>>::view_type& Rview, void computeMeans(ippl::ParticleAttrib<Vector_t<double,3>>::view_type& Rview,
ippl::ParticleAttrib<Vector_t<double,3>>::view_type& Pview, ippl::ParticleAttrib<Vector_t<double,3>>::view_type& Pview,
ippl::ParticleAttrib<double>::view_type& Mview, ippl::ParticleAttrib<double>::view_type& Mview,
size_t Np); size_t Np);
private:
bool isParticleExcluded(const OpalParticle&) const;
//template <class InputIt> //template <class InputIt>
//void computeMeans(const InputIt&, const InputIt&); //void computeMeans(const InputIt&, const InputIt&);
......
...@@ -180,6 +180,18 @@ public: ...@@ -180,6 +180,18 @@ public:
/// Apply the algorithm to a vertical FFA magnet. /// Apply the algorithm to a vertical FFA magnet.
virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet& bend); virtual void visitVerticalFFAMagnet(const VerticalFFAMagnet& bend);
// made following public: __host__ __device__ lambda cannot have private or protected access within its class
void kickParticles(const BorisPusher& pusher);
void pushParticles(const BorisPusher& pusher);
void timeIntegration2(BorisPusher& pusher);
void changeDT(bool backTrack = false);
void computeSpaceChargeFields(unsigned long long step);
void setTime();
private: private:
// Not implemented. // Not implemented.
ParallelTracker(); ParallelTracker();
...@@ -221,8 +233,6 @@ private: ...@@ -221,8 +233,6 @@ private:
/********************** END VARIABLES ***********************************/ /********************** END VARIABLES ***********************************/
void kickParticles(const BorisPusher& pusher);
void pushParticles(const BorisPusher& pusher);
void updateReferenceParticle(const BorisPusher& pusher); void updateReferenceParticle(const BorisPusher& pusher);
void writePhaseSpace(const long long step, bool psDump, bool statDump); void writePhaseSpace(const long long step, bool psDump, bool statDump);
...@@ -237,22 +247,18 @@ private: ...@@ -237,22 +247,18 @@ private:
void prepareSections(); void prepareSections();
void timeIntegration1(BorisPusher& pusher); void timeIntegration1(BorisPusher& pusher);
void timeIntegration2(BorisPusher& pusher);
void selectDT(bool backTrack = false); void selectDT(bool backTrack = false);
void changeDT(bool backTrack = false);
void emitParticles(long long step); void emitParticles(long long step);
void computeExternalFields(OrbitThreader& oth); void computeExternalFields(OrbitThreader& oth);
void computeWakefield(IndexMap::value_t& elements); void computeWakefield(IndexMap::value_t& elements);
void computeParticleMatterInteraction(IndexMap::value_t elements, OrbitThreader& oth); void computeParticleMatterInteraction(IndexMap::value_t elements, OrbitThreader& oth);
void computeSpaceChargeFields(unsigned long long step);
// void prepareOpalBeamlineSections(); // void prepareOpalBeamlineSections();
void dumpStats(long long step, bool psDump, bool statDump); void dumpStats(long long step, bool psDump, bool statDump);
void setOptionalVariables(); void setOptionalVariables();
bool hasEndOfLineReached(const BoundingBox& globalBoundingBox); bool hasEndOfLineReached(const BoundingBox& globalBoundingBox);
void handleRestartRun(); void handleRestartRun();
void setTime();
void doBinaryRepartition(); void doBinaryRepartition();
void transformBunch(const CoordinateSystemTrafo& trafo); void transformBunch(const CoordinateSystemTrafo& trafo);
...@@ -341,4 +347,4 @@ inline void ParallelTracker::pushParticles(const BorisPusher& pusher) { ...@@ -341,4 +347,4 @@ inline void ParallelTracker::pushParticles(const BorisPusher& pusher) {
ippl::Comm->barrier(); ippl::Comm->barrier();
} }
#endif // OPAL_ParallelTracker_HH #endif // OPAL_ParallelTracker_HH
\ No newline at end of file
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
// by the compiler perform the correct operation. For speed reasons // by the compiler perform the correct operation. For speed reasons
// they are not implemented. // they are not implemented.
#include <Kokkos_Core.hpp>
class PartData { class PartData {
public: public:
...@@ -48,10 +50,10 @@ public: ...@@ -48,10 +50,10 @@ public:
PartData(); PartData();
/// The constant charge per particle. /// The constant charge per particle.
double getQ() const; KOKKOS_INLINE_FUNCTION double getQ() const;
/// The constant mass per particle. /// The constant mass per particle.
double getM() const; KOKKOS_INLINE_FUNCTION double getM() const;
/// The constant reference momentum per particle. /// The constant reference momentum per particle.
double getP() const; double getP() const;
...@@ -101,12 +103,12 @@ protected: ...@@ -101,12 +103,12 @@ protected:
// Inline functions. // Inline functions.
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
inline double PartData::getQ() const { KOKKOS_INLINE_FUNCTION double PartData::getQ() const {
return charge; return charge;
} }
inline double PartData::getM() const { KOKKOS_INLINE_FUNCTION double PartData::getM() const {
return mass; return mass;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment