Alsvinn  0.5.3
The fast FVM simulator with UQ support
PowPower.hpp
Go to the documentation of this file.
1 #pragma once
2 #ifndef __CUDA_ARCH__
3  #include <cmath>
4 #else
5  #include <cuda.h>
6 #endif
7 namespace alsutils {
8 namespace math {
9 struct PowPower {
10 
11  __device__ __host__ static double power(double x, double p) {
12 #ifndef __CUDA_ARCH__ // commenting out this for cuda seemed to be necesary in a newer cuda version
13  using namespace std;
14 #endif
15 #if 0
16  double returnvalue = x;
17 
18  while (p > 1) {
19  returnvalue *= x;
20  p -= 1;
21  }
22 
23  return returnvalue;
24 #else
25  return pow(x, p);
26 #endif
27  }
28 };
29 }
30 }
#define __host__
Definition: types.hpp:46
__device__ static __host__ double power(double x, double p)
Definition: PowPower.hpp:11
Definition: PowPower.hpp:9
Various utilities for mpi and cuda.
Definition: Factory.hpp:3
#define __device__
Definition: types.hpp:45
float p
Definition: sodshocktube.py:5