- #1
swartzism
- 103
- 0
So I have a header file containing things like
and I am using a lot of MKL calls within my program. If I change REAL to float, I get a bunch of errors about those MKL calls being double and not float, so what I would like to do is something like this
Would this work? Is there a better way to ubiquitously change from single to double precision?
In the mean time, I'm going to go ahead and try and implement this, but I doubt it will work. Ha!
Thanks in advance.
Code:
#ifndef _params_h
#define _params_h
#define REAL double // precision of data
#define ALIGN 64 // byte size of alignment
#define DBG 1 // 1 prints out results
#define READIN 1 // 1 reads in white paper data, 0 randomizes data
#define NVAR 128 // ncols
#define NITER 25000 // nrows
#define MCITER 10000 // Monte Carlo iterations
#define RANDMIN -2
#define RANDMAX 2
#endif
and I am using a lot of MKL calls within my program. If I change REAL to float, I get a bunch of errors about those MKL calls being double and not float, so what I would like to do is something like this
Code:
#ifndef _params_h
#define _params_h
#define REAL double // precision of data
#define ALIGN 64 // byte size of alignment
#define DBG 1 // 1 prints out results
#define READIN 1 // 1 reads in white paper data, 0 randomizes data
#define NVAR 128 // ncols
#define NITER 25000 // nrows
#define MCITER 10000 // Monte Carlo iterations
#define RANDMIN -2
#define RANDMAX 2
#if REAL == double
#define GEMM cblas_dgemm
#define TRANS mkl_dimatcopy
#define CHOL dpotrf
#define INV LAPACKE_dtrtri
#else if REAL == float
#define GEMM cblas_sgemm
#define TRANS mkl_simatcopy
#define CHOL spotrf
#define INV LAPACKE_strtri
#endif
#endif
Would this work? Is there a better way to ubiquitously change from single to double precision?
In the mean time, I'm going to go ahead and try and implement this, but I doubt it will work. Ha!
Thanks in advance.