1 #define PRINT_STACKTRACE
4 #include "VCluster.hpp"
6 #include "util/print_stack.hpp"
7 #include "util/math_util_complex.hpp"
10 Vcluster<> * global_v_cluster_private_heap = NULL;
14 std::vector<int> sieve_spf;
17 size_t n_vcluster = 0;
18 bool ofp_initialized =
false;
23 std::string program_name;
27 #include "memory/CudaMemory.cuh"
40 void bt_sighandler(
int sig, siginfo_t * info,
void * ctx_p)
43 std::cout <<
"Got signal " << sig <<
" faulty address is %p, " << info->si_addr <<
" from " << info->si_pid << std::endl;
45 std:: cout <<
"Got signal " << sig << std::endl;
52 double time_spent = 0.0;
60 void openfpm_init_vcl(
int *argc,
char ***argv, MPI_Comm ext_comm)
63 #if defined (ENABLE_NUMERICS) && defined (HAVE_PETSC)
64 #ifndef PETSC_SAFE_CALL
65 #define PETSC_SAFE_CALL(call) {\
66 PetscErrorCode err = call;\
68 std::string msg("Petsc error: ");\
69 msg += std::string(__FILE__) + std::string(" ") + std::to_string(__LINE__);\
70 PetscInt ln = __LINE__;\
71 PetscError(PETSC_COMM_WORLD,ln,__FUNCTION__,__FILE__,err,PETSC_ERROR_INITIAL,"Error petsc");\
76 if (ext_comm!=MPI_COMM_WORLD)
78 PETSC_COMM_WORLD = ext_comm;
80 PetscBool initialized;
81 PETSC_SAFE_CALL(PetscInitialized(&initialized));
82 if(initialized==PETSC_FALSE)
84 PETSC_SAFE_CALL(PetscInitialize(argc,argv,NULL,NULL));
88 init_global_v_cluster_private(argc,argv,ext_comm);
91 std::cout <<
"OpenFPM is compiled with debug mode LEVEL:1. Remember to remove SE_CLASS1 when you go in production" << std::endl;
95 std::cout <<
"OpenFPM is compiled with debug mode LEVEL:2. Remember to remove SE_CLASS2 when you go in production" << std::endl;
99 std::cout <<
"OpenFPM is compiled with debug mode LEVEL:3. Remember to remove SE_CLASS3 when you go in production" << std::endl;
108 sa.sa_sigaction = bt_sighandler;
109 sigemptyset(&sa.sa_mask);
110 sa.sa_flags = SA_RESTART;
112 sigaction(SIGSEGV, &sa, NULL);
114 if (argc != NULL && *argc != 0)
115 {program_name = std::string(*argv[0]);}
118 openfpm::math::init_getFactorization();
120 ofp_initialized =
true;
129 for (
int i = 0 ; i < MAX_NUMER_OF_PROPERTIES ; i++)
138 size_t openfpm_vcluster_compilation_mask()
140 size_t compiler_mask = CUDA_ON_BACKEND;
142 return compiler_mask;
150 void openfpm_finalize()
152 #if defined (ENABLE_NUMERICS) && defined (HAVE_PETSC)
158 delete_global_v_cluster_private();
159 ofp_initialized =
false;
170 for (
int i = 0 ; i < MAX_NUMER_OF_PROPERTIES ; i++)
virtual void incRef()
Increment the reference counter.
virtual void decRef()
Decrement the reference counter.
virtual void destroy()
destroy memory
Implementation of VCluster class.