-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path4_fitfunctions_demo.cpp
34 lines (27 loc) · 1.2 KB
/
4_fitfunctions_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
/*
* Compile without GPU support:
* c++ -std=c++17 -pthread -I../src 4_fitfunctions_demo.cpp -o 4_fitfunctions_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 4_fitfunctions_demo.cpp -o 4_fitfunctions_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]/(1.1-x[1])/(1.1-x[2]);
}
} my_functor;
int main() {
const unsigned int MAXVAR = 3;
integrators::Qmc<double,double,MAXVAR,integrators::transforms::Korobov<3>::type,integrators::fitfunctions::PolySingular::type> integrator;
integrators::result<double> result = integrator.integrate(my_functor);
std::cout << "integral = " << result.integral << std::endl;
std::cout << "error = " << result.error << std::endl;
return 0;
}