Skip to content

Commit

Permalink
clean and update the howto
Browse files Browse the repository at this point in the history
  • Loading branch information
exaexa committed Apr 27, 2023
1 parent d126fa6 commit 8ab5549
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@ Flux samplers for
[COBREXA.jl](https://github.com/LCSB-BioCore/COBREXA.jl/),
accelerated on GPUs via [CUDA.jl](https://github.com/JuliaGPU/CUDA.jl).

The repository contents is work in progress, but the existing code should generally work. The implemented samplers currently include:
The repository contains the following modules with samplers:
- Affine-combination-directed Hit&Run (module `CuFluxSampler.AffineHR`)
- Artificially-Centered Hit&Run (module `CuFluxSampler.ACHR`)

Both modules export a specific function for running the sampler atop COBREXA.jl
`MetabolicModel` structure, typically called `sample`. See the code comments
and documentation for details.

Samplers support many options that can be turned on and off, in general:
- Number of points used for mixing the new run directions in `AffineHR` may be
changed by `mix_points` parameter, and you can alternatively supply your own
mixing matrix in `mix_mtx`.
- You can turn on/off the stoichiometry checks with `check_stoichiometry` and
tune it with `epsilon` (in both `ACHR` and `AffineHR`)
- You can add tolerance bounds on stoichiometry in order to expand the feasible
region a little to allow randomized runs to succeed; see
`check_stoichiometry` and `direction_noise_max` parameters.
- You can set a seed for the GPU-generated random numbers using `seed`

Running the package code and tests requires a CUDA-capable GPU.

Expand Down
2 changes: 1 addition & 1 deletion src/ACHR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function sample(
# run the iterations
for iter = 1:iters

dirs .= sum(dirs; dims = 1) ./ npts .- pts
dirs .= (sum(pts; dims = 2) ./ npts) .- pts

if add_noise
@cuda threads = 256 blocks = 32 TeaRNG.device_add_unif_rand!(
Expand Down
2 changes: 0 additions & 2 deletions src/AffineHR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ function sample(
seed = Random.rand(UInt32),
mix_points = 3,
mix_mtx = random_mix_matrix(size(start, 2), mix_points),
permute_mtx = random_permute_matrix(size(start, 2)),
)
# allocate base helper variables
npts = size(start, 2)
Expand All @@ -76,7 +75,6 @@ function sample(
lws = CUDA.zeros(1, npts)
oks = CUDA.zeros(Bool, 1, npts)
mix = CUDA.CUSPARSE.CuSparseMatrixCSR(Float32.(mix_mtx))
permute = CUDA.CUSPARSE.CuSparseMatrixCSR(Float32.(permute_mtx))

# extract model data
S = CUDA.CUSPARSE.CuSparseMatrixCSR(Float32.(COBREXA.stoichiometry(m)))
Expand Down

2 comments on commit 8ab5549

@exaexa
Copy link
Collaborator Author

@exaexa exaexa commented on 8ab5549 May 16, 2023

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/83655

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 8ab554932195608b6e0e668532fd3c0588b1fd8f
git push origin v0.1.0

Please sign in to comment.