stan-dev / stan-dev/math

Allow OpenCL simplex to use softmax?

Open
#2,968 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

I'm in the process of writing out the deserializer for OpenCL so we can have models that run entirely on the GPU. We do not yet have a simplex_constrain/unconstrain function in OpenCL.

I could do the stick breaking scheme on the gpu, I think it would be a weighted prefix product. That's possible for me to write but will take me a minute. The other alternative is just to use softmax. Since that's just exp(x_i) / sum(exp(X)) that's much easier to write for the GPU.

The downside of the softmax is that the cpu/gpu versions will be different, but we could just add that to the user docs so people know.

Does anyone have thoughts on this?

Current Version:

v4.7.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the OpenCL entry points for simplex_constrain/unconstrain and the existing softmax implementation; the issue names no files or tests. Review the stick-breaking and softmax alternatives, then establish the expected CPU/GPU behavior and documentation changes before determining what would count as done.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
hpc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.