Comments (2)
It's a bit more complicated. If we allow full flexibility for the user, we have to declare both the single and double precision versions of all function. Either replication or macros like in fftw3.h
. This requires more work, either renaming functions as in FFTW shift
-> shiftf
etc or allow only function that have a data type so we can overload. This is currently not possible for example for C_acc_fft(int nx, void* data)
. It is not possible to define data
's type from that declaration.
So I'd prefer to force users to decide at compile time between single and double precision. If somebody needs more later on, we can discuss. For now, that's too much work.
from galario.
Here is a minimal program compile-test.cxx
#include "galario.hpp"
#include <complex>
#include <iostream>
#include <vector>
int main()
{
constexpr int nx = 5;
std::vector<dcomplex> data(nx*nx);
std::cout << "Size of data type: " << sizeof(dcomplex) << std::endl;
C_acc_shift(nx, &data[0]);
return 0;
}
and how to run it with double precision
export GALARIODIR=$SWMOD_INST_PREFIX
$ g++ -std=c++14 -fopenmp -I$GALARIODIR/include/ compile-test.cxx -L$GALARIODIR/lib/ -DDOUBLE_PRECISION -lgalario -o compile-test && ./compile-test
Size of data type: 16
and single precision
$ g++ -std=c++14 -fopenmp -I$GALARIODIR/include/ compile-test.cxx -L$GALARIODIR/lib/ -lgalario_single -o compile-test && ./compile-test
Size of data type: 8
It is clunky and error prone that you one has to define a preprocessor symbol for double with -DDOUBLE_PRECISION
and the matching library name but for single, only the library name is needed.
I think for external users there is a potential for a name conflict for DOUBLE_PRECISION
. We'd better name it GALARIO_DOUBLE
. In addition, we have to make up our mind if single or double should be the default. Sticking with single would mean less work for the moment
from galario.
Related Issues (20)
- Add link to paper citations HOT 2
- Coordinate mesh grid
- Update Copyright statement for 2020
- AttributeError: 'function' object has no attribute 'called' HOT 5
- Initial guess for the parameters HOT 1
- galario.c still in source
- travis tests are not reported anymore... HOT 1
- Docs deploy is broken HOT 3
- Perform tests for Python 3.8
- Move to GitHub Actions HOT 2
- Fix numpy warnings
- Move docs to readthedocs
- Update 2020->2021 in Copyright notices
- Trouble building galario for GPU use HOT 7
- Test building GPU version on CUDA 11
- Scaling with CUDA cores and changing GPUs
- Move uvtable.txt to a permanent repository HOT 4
- dxy returned by get_image_size is radians - Fix typo in docs HOT 1
- origin at chi2Image HOT 1
- unrecognized argument when running ctest
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from galario.