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

Support to retry the host allocation for hybrid converters #12251

Open
wants to merge 7 commits into
base: branch-25.04
Choose a base branch
from

Conversation

firestarman
Copy link
Collaborator

@firestarman firestarman commented Mar 4, 2025

Contributes to #8874

This PR adds the retry protection to host memory allocations used by the C2C converters in Hybrid scans. This is done by introducing a new class named HybridHostRetryAllocator who implements the Hybrid host allocator interface with retry support. It will close the allocated buffers just before each retry starts, to leave more memory for higher priority tasks.

This change also introduces another new trait named HostRetryAllocator to extract the retry code from the hybrid things to avoid loading hybrid jar when running the new unit tests.

This is to try to resolve the following kind of OOMs:

com.nvidia.spark.rapids.jni.CpuRetryOOM: Could not complete allocation after 1000 retries
        at com.nvidia.spark.rapids.HostAlloc.alloc(HostAlloc.scala:272)
        at com.nvidia.spark.rapids.HostAlloc.allocate(HostAlloc.scala:278)
        at ai.rapids.cudf.HostMemoryBuffer.allocate(HostMemoryBuffer.java:138)
        at com.nvidia.spark.rapids.velox.VeloxBatchConverter.createVectorBuilder(VeloxBatchConverter.scala:337)
        at com.nvidia.spark.rapids.velox.VeloxBatchConverter.$anonfun$resetTargetBuffers$3(VeloxBatchConverter.scala:236)
        at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
        at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
        at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
        at com.nvidia.spark.rapids.velox.VeloxBatchConverter.resetTargetBuffers(VeloxBatchConverter.scala:232)
        at com.nvidia.spark.rapids.velox.VeloxBatchConverter.<init>(VeloxBatchConverter.scala:183)
        at com.nvidia.spark.rapids.velox.VeloxBatchConverter$.apply(VeloxBatchConverter.scala:384)

@firestarman firestarman requested a review from a team as a code owner March 4, 2025 02:12
@firestarman
Copy link
Collaborator Author

build

Signed-off-by: Firestarman <[email protected]>
@firestarman
Copy link
Collaborator Author

build

tests/pom.xml Outdated
<dependency>
<groupId>com.nvidia</groupId>
<artifactId>rapids-4-spark-hybrid_${scala.binary.version}</artifactId>
<version>${project.version}</version>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please use the version of hybrid itself like other places:

        <dependency>
            <groupId>com.nvidia</groupId>
            <artifactId>rapids-4-spark-hybrid_${scala.binary.version}</artifactId>
            <version>${spark-rapids-hybrid.version}</version>
            <scope>provided</scope>
        </dependency>

Like private jar, it has its own version.
During the release process, the project.version is not always equal to spark-rapids-hybrid.version.

And set scope as <scope>test</scope>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nice catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated. I created an item for hyrid jar in the dependencyManagement section in the root pom to unify its version for sub modules.

@firestarman
Copy link
Collaborator Author

build

res-life
res-life previously approved these changes Mar 4, 2025
Copy link
Collaborator

@res-life res-life left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: Firestarman <[email protected]>
Signed-off-by: Firestarman <[email protected]>
@firestarman
Copy link
Collaborator Author

build

Copy link
Collaborator

@sperlingxx sperlingxx left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants