A new implementation of C++ std::complex for complex numbers on CUDA
I have written a new implementation of C++ std::complex for use of complex numbers on CUDA devices.
It is is heavily derived from the LLVM libcpp project.

Apart from nvcc, it should also work wih any C++03 compiler.
It is quiet complete. As far as I can tell the only missing features are:
- long double support (not supported on CUDA)
- some integral pow functions (due to lack of C++11 support on CUDA)

The code is available on githib:

http://github.com/jtravs/cuda_complex

Please let me know of any improvements/errors you find with it.

Thanks,
John
I have written a new implementation of C++ std::complex for use of complex numbers on CUDA devices.

It is is heavily derived from the LLVM libcpp project.



Apart from nvcc, it should also work wih any C++03 compiler.

It is quiet complete. As far as I can tell the only missing features are:

- long double support (not supported on CUDA)

- some integral pow functions (due to lack of C++11 support on CUDA)



The code is available on githib:



http://github.com/jtravs/cuda_complex



Please let me know of any improvements/errors you find with it.



Thanks,

John

#1
Posted 04/09/2012 09:00 PM   
what are the minimum requirements regarding the CUDA toolkit version?

Christian
what are the minimum requirements regarding the CUDA toolkit version?



Christian

#2
Posted 04/10/2012 09:27 AM   
[quote name='cbuchner1' date='10 April 2012 - 10:27 AM' timestamp='1334050071' post='1394151']
what are the minimum requirements regarding the CUDA toolkit version?

Christian
[/quote]

I'm not entirely sure. I wrote and tested it with version 4.1. It should also work with 4.0.
BTW you may also be interested in the Cusp library which has an alternative implementation (which I didn't know about when writing this one):

http://code.google.com/p/cusp-library/source/browse/cusp/complex.h

John
[quote name='cbuchner1' date='10 April 2012 - 10:27 AM' timestamp='1334050071' post='1394151']

what are the minimum requirements regarding the CUDA toolkit version?



Christian





I'm not entirely sure. I wrote and tested it with version 4.1. It should also work with 4.0.

BTW you may also be interested in the Cusp library which has an alternative implementation (which I didn't know about when writing this one):



http://code.google.com/p/cusp-library/source/browse/cusp/complex.h



John

#3
Posted 04/10/2012 09:46 AM   
John, I tried to use your complex number on device __device__ complex<float> complex_CUDA; And I got this 'error: can't generate code for non empty constructors or destructors on device' What is wrong?
John, I tried to use your complex number on device

__device__ complex<float> complex_CUDA;

And I got this 'error: can't generate code for non empty constructors or destructors on device'

What is wrong?

#4
Posted 07/03/2013 06:48 AM   
Scroll To Top