Ensign
Low-rank framework for multi-core CPUs and GPUs
Loading...
Searching...
No Matches
common.hpp
Go to the documentation of this file.
1
36#pragma once
37
38#include <iostream>
39#include <fstream>
40#include <cmath>
41#include <iterator>
42#include <array>
43#include <vector>
44#include <algorithm>
45#include <assert.h>
46#include <complex>
47#include <string>
48#include <memory>
49
50#ifdef __MKL__
51 #include <mkl.h>
52#else
53 #include <cblas.h>
54#endif
55#include <fftw3.h>
56#include <functional>
57#include <random>
58
59#ifdef __CUDA__
60#include <cuda_runtime.h>
61#include "cublas_v2.h"
62#include <cufft.h>
63#include <curand.h>
64#include <cusolverDn.h>
65#endif
66
67#ifdef __OPENMP__
68#include <omp.h>
69#endif
70
71using std::cout;
72using std::endl;
73using std::ofstream;
74using std::max;
75using std::array;
76using std::vector;
77using std::fill;
78using std::abs;
79using std::complex;
80using std::string;
81using std::to_string;
82
83typedef ptrdiff_t Index;
84enum class stloc { host, device };
85
86#ifdef __CUDA__
87const int n_threads = 128;
88#endif
89
90#ifdef __OPENMP__
91const int n_threads_omp = 32;
92#endif
93
94
96namespace Ensign {
97
98// make_unique implementation for compiler that do not support it yet
99template<typename T, typename... Args>
100std::unique_ptr<T> make_unique_ptr(Args&&... args)
101{
102 return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
103}
104
105} // namespace Ensign
ptrdiff_t Index
Definition common.hpp:83
stloc
Definition common.hpp:84
const int n_threads_omp
Definition common.hpp:91
Core namespace for Ensign's numerical algorithms and data structures.
Definition common.hpp:96
std::unique_ptr< T > make_unique_ptr(Args &&... args)
Definition common.hpp:100