Coder Social home page Coder Social logo

install header about galario HOT 2 CLOSED

mtazzari avatar mtazzari commented on August 28, 2024
install header

from galario.

Comments (2)

fredRos avatar fredRos commented on August 28, 2024

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.

fredRos avatar fredRos commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.