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

Add test-gpu task #6217

Merged
merged 12 commits into from
May 7, 2024
Merged

Add test-gpu task #6217

merged 12 commits into from
May 7, 2024

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented May 5, 2024

This should make it easier to test CuDF (locally). I'm using it as a marker as I only want to be able to run the GPU tests if this task is called.

image

I have used the versions from https://github.com/rapidsai/cudf?tab=readme-ov-file#conda

@hoxbro hoxbro added the type: maintenance infrastructure and maintenance of CI label May 5, 2024
Copy link

codecov bot commented May 5, 2024

Codecov Report

Attention: Patch coverage is 34.00000% with 66 lines in your changes are missing coverage. Please review.

Project coverage is 88.18%. Comparing base (bc684e3) to head (49ddb0b).
Report is 3 commits behind head on main.

Files Patch % Lines
holoviews/element/selection.py 9.09% 20 Missing ⚠️
holoviews/tests/operation/test_operation.py 35.71% 18 Missing ⚠️
holoviews/tests/element/test_selection.py 26.66% 11 Missing ⚠️
holoviews/tests/core/data/test_cudfinterface.py 46.66% 8 Missing ⚠️
holoviews/core/data/cudf.py 0.00% 5 Missing ⚠️
holoviews/tests/operation/test_datashader.py 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6217      +/-   ##
==========================================
- Coverage   88.21%   88.18%   -0.04%     
==========================================
  Files         321      321              
  Lines       67289    67360      +71     
==========================================
+ Hits        59361    59402      +41     
- Misses       7928     7958      +30     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

pyproject.toml Outdated Show resolved Hide resolved
@hoxbro hoxbro changed the title Add GPU task Add test-gpu task May 6, 2024
@hoxbro
Copy link
Member Author

hoxbro commented May 6, 2024

Also added support for _select_mask_neighbor as the test was easy to run.

image

if isinstance(xvals, cudf.Series):
xvals = xvals.values.astype('float')
yvals = yvals.values.astype('float')
try:
import cuspatial
result = cuspatial.point_in_polygon(
result = cuspatial.point_in_polygon( # TODO: now only takes two arguments
Copy link
Member Author

Choose a reason for hiding this comment

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

@AjayThorve, can you help me get cuspatial up and running if you have time?

I get this error TypeError: point_in_polygon() takes 2 positional arguments but 6 were given when running the test. I assume this has worked at some point.

Choose a reason for hiding this comment

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

Hey @hoxbro. yes there have been some changes in the point_in_polygon api, it only takes two parameters now, both cuspatial GeoSeries (points, polygons). Here is something that might work:

import cudf
import cupy as cp
from shapely.geometry import Polygon
import geopandas

if isinstance(xvals, cudf.Series):
    xvals = xvals.values.astype('float')
    yvals = yvals.values.astype('float')
    try:
        import cuspatial
        df = cudf.DataFrame({'x':xvals, 'y':yvals})
        points = cuspatial.GeoSeries.from_points_xy(
           df.interleave_columns().astype('float')
        )
        polygons = cuspatial.GeoSeries(
           geopandas.GeoSeries(Polygon(geometry)), index=["selection"]
        )

        result = cuspatial.point_in_polygon(points.polygon)

        return result.selection

ref:

  1. https://docs.rapids.ai/api/cuspatial/nightly/api_docs/geopandas_compatibility/#cuspatial.GeoSeries

  2. https://docs.rapids.ai/api/cuspatial/nightly/user_guide/cuspatial_api_examples/#cuspatial.point_in_polygon

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you so much! Worked like a charm.

Do you have a version of when the changes were made?

@hoxbro hoxbro enabled auto-merge (squash) May 7, 2024 18:57
@hoxbro hoxbro merged commit e70ed32 into main May 7, 2024
13 checks passed
@hoxbro hoxbro deleted the add_gpu_task branch May 7, 2024 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: maintenance infrastructure and maintenance of CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants