Skip to content

Adding defines as _additional_ preprocessor definitions  #234

Closed

Description

@loostrum

I have a kernel where I tune a bunch of parameters, but need to insert some static values as well (think problem size etc.) as preprocessor definitions. I thought I'd be able to use the defines option for this, but using that means the tunable parameters are no longer inserted. It would be great if there'd be a way to insert both the tunable parameters and some more defines.

Currently I'm using single-value tunable parameters as a workaround, but it clutters the tuning output a bit.

Activity

  1. stijnh commented on Dec 6, 2023

    @stijnh
    Member

    You should be able to use:

    defines = dict(
    block_size_x=lambda p: p["block_size_x"],
    use_smem=lambda p: p["use_smem"],
    ...
    )

    If I remember correctly, this should also work:

    defines = dict(
    block_size_x="block_size_x",
    use_smem="use_smem",
    ...
    )

    In which case, you can generate the dict automatically:

    defines = {key: key for key in tune_params}
    defines["another_variable"] = 1
    defines["more_variables"] = 2
  2. loostrum commented on Dec 7, 2023

    @loostrum
    MemberAuthor

    Thanks for the tip, that should solve my issue!

  3. stijnh commented on Dec 7, 2023

    @stijnh
    Member

    Great! This should be documented better since currently its a bit hidden away in the API documentation between all the other keyword argument descriptions.

  4. benvanwerkhoven commented on Dec 7, 2023

    @benvanwerkhoven
    Collaborator

    At least the API documentation is visible again! haha

  5. locked and limited conversation to collaborators on Dec 8, 2023
  6. converted this issue into a discussion #235 on Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions