Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor thrust::complex as a struct derived from cuda::std::complex #454

Merged
merged 7 commits into from
Sep 26, 2023

Conversation

Blonck
Copy link
Contributor

@Blonck Blonck commented Sep 18, 2023

This commit refactors the thrust::complex type to be a struct derived
from cuda::std::complex, enabling reuse of existing implementation
logic. However, to maintain backward compatibility, certain
operators are reintroduced to allow type promotion between float
and double for the underlying type.

This PR is derived from #260 and has been rebased onto the current main branch

Checklist

miscco and others added 2 commits September 18, 2023 12:27
There are some notable differences though. thrust::complex has been a
bit more lenient when determining the type of arithmetic operations.

That said, I believe being more strict is actually a feature not a bug
This commit refactors the thrust::complex type to be a struct derived
from cuda::std::complex, enabling reuse of existing implementation
logic. However, to maintain backward compatibility, certain
operators are reintroduced to allow type promotion between 'float'
and 'double' for the underlying type.
@Blonck Blonck requested review from a team as code owners September 18, 2023 15:07
@Blonck Blonck requested review from wmaxey and griwes and removed request for a team September 18, 2023 15:07
@copy-pr-bot
Copy link

copy-pr-bot bot commented Sep 18, 2023

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Blonck Blonck requested review from alliepiper and removed request for a team September 18, 2023 15:07
@miscco
Copy link
Collaborator

miscco commented Sep 18, 2023

/ok to test

@miscco
Copy link
Collaborator

miscco commented Sep 19, 2023

/ok to test

@miscco
Copy link
Collaborator

miscco commented Sep 19, 2023

So this is failing because I removed the long double overloads that are actually removed and static asserted that we should never use them. I believe we should also remove that test

@miscco
Copy link
Collaborator

miscco commented Sep 19, 2023

/ok to test

@miscco
Copy link
Collaborator

miscco commented Sep 20, 2023

/ok to test

Copy link
Collaborator

@miscco miscco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome 🎉

Thanks a lot for putting all the work in and improving our complex implementation.

Given that I had some part in writing some of the code I would want a second maintainers eyes before we merge though

@@ -1191,6 +1188,7 @@ arg(const complex<_Tp>& __c)
return _CUDA_VSTD::atan2(__c.imag(), __c.real());
}

#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@griwes This was preexisting in libcu++

I consider this a preexisting bug. Do you have any objections in disabling long double when it is not defined?

thrust/thrust/complex.h Outdated Show resolved Hide resolved
@miscco
Copy link
Collaborator

miscco commented Sep 24, 2023

/ok to test

@miscco
Copy link
Collaborator

miscco commented Sep 25, 2023

The complex files were under an old apache license we should clean the new files up given that we completely reimplemented it

@miscco
Copy link
Collaborator

miscco commented Sep 26, 2023

/ok to test

@miscco miscco merged commit 1f6e4bc into NVIDIA:main Sep 26, 2023
396 checks passed
miscco added a commit to miscco/cccl that referenced this pull request Jan 16, 2024
jrhemstad added a commit that referenced this pull request Jan 17, 2024
miscco added a commit to miscco/cccl that referenced this pull request Feb 22, 2024
…d::complex` (NVIDIA#454)" (NVIDIA#1286)

We did not have any time to work on fixing the numerical issues with `cuda::std::complex` so punt on it for 2.4.x

Co-authored-by: Jake Hemstad <[email protected]>
miscco added a commit to miscco/cccl that referenced this pull request Mar 6, 2024
…d::complex` (NVIDIA#454)"

This reverts commit 1f6e4bc.

We face numerical issues with our cuda::std::complex implementation but did not have the capacity to work on it
miscco added a commit to miscco/cccl that referenced this pull request Mar 6, 2024
…d::complex` (NVIDIA#454)"

This reverts commit 1f6e4bc.

We face numerical issues with our cuda::std::complex implementation but did not have the capacity to work on it
miscco added a commit that referenced this pull request Mar 7, 2024
…d::complex` (#454)" (#1497)

This reverts commit 1f6e4bc.

We face numerical issues with our cuda::std::complex implementation but did not have the capacity to work on it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants