Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
COBREXA.jl
Manage
Activity
Members
Plan
External wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LCSB-BioCore
COBREXA.jl
Commits
468a7eda
Unverified
Commit
468a7eda
authored
3 years ago
by
St. Elmo
Browse files
Options
Downloads
Patches
Plain Diff
parallel HR
parent
e77b6554
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/analysis/sampling/hit_and_run.jl
+24
-0
24 additions, 0 deletions
src/analysis/sampling/hit_and_run.jl
with
24 additions
and
0 deletions
src/analysis/sampling/hit_and_run.jl
+
24
−
0
View file @
468a7eda
...
...
@@ -54,15 +54,39 @@ function hit_and_run(
keepevery
=
_constants
.
sampling_keep_iters
,
samplesize
=
_constants
.
sampling_size
,
warmup_indices
=
collect
(
1
:
n_reactions
(
model
)),
workers
=
[
myid
()],
nchains
=
1
,
)
# get warmup points in parallel, similar to FVA
ws
,
lbs
,
ubs
=
warmup
(
model
,
optimizer
;
modifications
=
modifications
,
warmup_points
=
warmup_indices
,
workers
=
workers
,
# parallel
)
# load warmup points to workers
map
(
fetch
,
save_at
.
(
workers
,
:
ws
,
Ref
(
:
(
$
ws
))))
map
(
fetch
,
save_at
.
(
workers
,
:
lbs
,
Ref
(
:
(
$
lbs
))))
map
(
fetch
,
save_at
.
(
workers
,
:
ubs
,
Ref
(
:
(
$
ubs
))))
# do in parallel!
chains
=
dpmap
(
x
->
:
(
$
COBREXA
.
_serial_hit_and_run
(
ws
,
lbs
,
ubs
,
$
samplesize
,
$
keepevery
,
$
N
)),
CachingPool
(
workers
),
1
:
nchains
,
)
# remove warmup points from workers
map
(
fetch
,
remove_from
.
(
workers
,
:
ws
))
map
(
fetch
,
remove_from
.
(
workers
,
:
lbs
))
map
(
fetch
,
remove_from
.
(
workers
,
:
ubs
))
return
chains
end
function
_serial_hit_and_run
(
ws
,
lbs
,
ubs
,
samplesize
,
keepevery
,
N
)
samples
=
zeros
(
length
(
lbs
),
samplesize
)
# sample storage
current_point
=
zeros
(
length
(
lbs
))
current_point
.=
ws
[
1
,
1
]
# just use the first warmup point, randomness is introduced later
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment