Skip to content

[RFC] Is the purpose of *_api.cu tests in CUB to only test API examples? #9078

Open

Description

@bernhardmgruber

I had the discussion below with @gonidelis on the conventions of *_api.cu files, which in my understanding are only containing tests of API examples appearing in the documentation.

In order to make progress on some critical PRs, I will not block them on non-API examples being added to those files, but we should agree on a guideline on where to put tested API examples for the documentation, which are not intended to be functional tests. This decision should then be documented in the CUB developer guide.

  1. doesn't have to be an example to go under the _api.cu test. It's literally what the name suggest, an API test, not an example (which the file name doesn't even suggest).

This is contrary to my understanding. _api.cu contain only API examples which are referenced from the documentation. They do not contain any functional tests.

Functional tests are always in files like catch2_test_device_algorithmname.cu (with some variations). You also added tests named catch2_test_device_algorithmname_env.cu, which test whether the handling of the execution environment works correctly, with little or no focus on algorithmic correctness.

Please elaborate why we need to break the convention now, or where it has been broken before.

Originally posted by @bernhardmgruber in #8979 (comment)

Activity

  1. gonidelis commented on May 20, 2026

    @gonidelis
    Member

    This is contrary to my understanding. _api.cu contain only API examples which are referenced from the documentation. They do not contain any functional tests.

    I don't see a reason for the "only" part to be true. It can have both literalinclude examples (which btw, many times we do have examples that are not included in the algorithms' docs) and single api examples that strip all defaults to see if ambiguities are created. It's two different sets of tests both under the API umbrella. One set shows how to use the api and the other one shows that the minimal api usage is non ambiguous

  2. bernhardmgruber commented on May 20, 2026

    @bernhardmgruber
    ContributorAuthor

    But with the same argument I can also add tests whether the env API functions, or a tuning is considered. There is no criterion distinguishing what belongs into which file now.

  3. gonidelis commented on May 20, 2026

    @gonidelis
    Member

    We are. In test_device*_env_api.cu files

  4. bernhardmgruber commented on May 21, 2026

    @bernhardmgruber
    ContributorAuthor

    But with the same argument I can also add tests whether the env API functions, or a tuning is considered. There is no criterion distinguishing what belongs into which file now.
    We are. In test_device*_env_api.cu files

    No, the tests I described above are in test_device*_env.cu

    test_device*_env_api.cu is for testing API documentation examples of using environment overloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

  • Status
    Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions