Skip to content

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

Merged
miscco merged 7 commits into
NVIDIA:mainfrom
Blonck:replace_complex
Sep 26, 2023
Merged

miscco merged 7 commits into
NVIDIA:mainfrom
Blonck:replace_complex

Conversation

@Blonck

@Blonck Blonck commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

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 griwes and wmaxey and removed request for a team September 18, 2023 15:07
@copy-pr-bot

copy-pr-bot Bot commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

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
Comment thread thrust/thrust/complex.h Resolved
@miscco

miscco commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@miscco

miscco commented Sep 19, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@miscco

miscco commented Sep 19, 2023

Copy link
Copy Markdown
Contributor

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

miscco commented Sep 19, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@miscco

miscco commented Sep 20, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@miscco miscco left a comment

Copy link
Copy Markdown
Contributor

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

return _CUDA_VSTD::atan2(__c.imag(), __c.real());
}

#ifdef _LIBCUDACXX_HAS_COMPLEX_LONG_DOUBLE

Copy link
Copy Markdown
Contributor

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?

Comment thread thrust/thrust/complex.h Resolved
@miscco

miscco commented Sep 24, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@miscco

miscco commented Sep 25, 2023

Copy link
Copy Markdown
Contributor

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

@miscco

miscco commented Sep 26, 2023

Copy link
Copy Markdown
Contributor

/ok to test

@miscco
miscco merged commit 1f6e4bc into NVIDIA:main Sep 26, 2023
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