NVIDIA / warp

A Python framework for high performance GPU simulation and graphics
https://nvidia.github.io/warp/
Other
4.07k stars 224 forks source link

math functions for double-precision #269

Closed jinz2014 closed 1 month ago

jinz2014 commented 1 month ago

Are there math functions for double-precision floating-point operations ? Thanks.

jinz2014 commented 1 month ago

I also got the error:

unsupported operand type(s) for *: 'float64' and 'float64'

a = wp.float64(0.1) b = wp.float64(0.1) a * b

shi-eric commented 1 month ago

Are there math functions for double-precision floating-point operations ? Thanks.

Yes, please take a look at the function signatures here to see if there is a double-precision version: https://nvidia.github.io/warp/modules/functions.html

I also got the error:

unsupported operand type(s) for *: 'float64' and 'float64'

a = wp.float64(0.1) b = wp.float64(0.1) a * b

I assume you're trying to do this at the Python scope, outside of a @wp.func or @wp.kernel decorated function? We don't currently define operator overloads for fundamental types like wp.float64. Try moving the code into the kernel scope. @christophercrouzet: Any thoughts here?

jinz2014 commented 1 month ago

There are no function for double-precision operations in Scalar Math. Right ?

Yes, at the Python scope.

christophercrouzet commented 1 month ago

Hi @jinz2014, thanks for reporting this issue!

We've just merged the commit 4094d6a in the branch main that addresses this, so it will be part of the next release!