-
Notifications
You must be signed in to change notification settings - Fork 5
/
5_generatingvectors_demo.cpp
35 lines (28 loc) · 1.24 KB
/
5_generatingvectors_demo.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Compile without GPU support:
* c++ -std=c++17 -pthread -I../src 5_generatingvectors_demo.cpp -o 5_generatingvectors_demo.out -lgsl -lgslcblas
* Compile with GPU support:
* nvcc -arch=<arch> -std=c++17 -rdc=true -x cu -Xptxas -O0 -Xptxas --disable-optimizer-constants -I../src 5_generatingvectors_demo.cpp -o 5_generatingvectors_demo.out -lgsl -lgslcblas
* Here `<arch>` is the architecture of the target GPU or `compute_30` if you are happy to use Just-in-Time compilation (See the Nvidia `nvcc` manual for more details).
*/
#include <iostream>
#include "qmc.hpp"
struct my_functor_t {
const unsigned long long int number_of_integration_variables = 3;
#ifdef __CUDACC__
__host__ __device__
#endif
double operator()(double* x) const
{
return x[0]*x[1]*x[2];
}
} my_functor;
int main() {
const unsigned int MAXVAR = 3;
integrators::Qmc<double,double,MAXVAR,integrators::transforms::Korobov<3>::type> integrator;
integrator.generatingvectors = integrators::generatingvectors::cbcpt_dn2_6();
integrators::result<double> result = integrator.integrate(my_functor);
std::cout << "integral = " << result.integral << std::endl;
std::cout << "error = " << result.error << std::endl;
return 0;
}