-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#if defined(__NVCC__) | ||
|
||
#include <math_helper.cuh> | ||
|
||
#else | ||
|
||
#include "../generic/math_helper.h" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include <cmath> | ||
|
||
namespace quda { | ||
|
||
inline float abs(const float a) { return fabs(a); } | ||
inline double abs(const double a) { return fabs(a); } | ||
template <typename T> inline T sqrt(const T a) { return ::sqrt(a); } | ||
template <typename T> inline T exp(const T a) { return ::exp(a); } | ||
template <typename T> inline T log(const T a) { return ::log(a); } | ||
template <typename T> inline T sin(const T a) { return ::sin(a); } | ||
template <typename T> inline T cos(const T a) { return ::cos(a); } | ||
template <typename T> inline T sinh(const T a) { return ::sinh(a); } | ||
template <typename T> inline T cosh(const T a) { return ::cosh(a); } | ||
template <typename T> inline T max(const T a, const T b) { return a > b ? a : b; } | ||
template <typename T> inline T min(const T a, const T b) { return a < b ? a : b; } | ||
template <typename T> inline void sincos(const T a, T *s, T *c) { ::sincos(a, s, c); } | ||
template <typename T> inline void sincospi(const T a, T *s, T *c) { ::sincos(a * static_cast<T>(M_PI), s, c); } | ||
template <typename T> inline T sinpi(const T a) { return ::sin(a * static_cast<float>(M_PI)); } | ||
template <typename T> inline T cospi(const T a) { return ::cos(a * static_cast<float>(M_PI)); } | ||
template <typename T> inline T rsqrt(const T a) { return static_cast<T>(1.0) / ::sqrt(a); } | ||
//template <typename T> inline T rsqrt(T a) { return ::rsqrt(a); } | ||
template <typename T> inline T pow(const T a, const T b) { return ::pow(a, b); } | ||
template <typename T> inline T pow(const T a, const int b) { return ::pow(a, b); } | ||
template <typename T> inline T fpow(const T a, const int b) { return ::pow(a, b); } | ||
inline float fdividef(const float a, const float b) { return a / b; } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#if defined(__HIP__) | ||
|
||
#include <math_helper.cuh> | ||
|
||
#else | ||
|
||
#include "../generic/math_helper.h" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <math_helper.cuh> |