-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathmultithreading.jl
More file actions
33 lines (29 loc) · 866 Bytes
/
multithreading.jl
File metadata and controls
33 lines (29 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# global variables to control multi-threading behaviors
global nthreads_mul::Int64
global nthreads_eigh::Int64
global nthreads_svd::Int64
global nthreads_add::Int64
function set_num_threads_mul(n::Int64)
@assert 1 ≤ n ≤ Threads.nthreads()
global nthreads_mul = n
return nothing
end
get_num_threads_mul() = nthreads_mul
function set_num_threads_add(n::Int64)
@assert 1 ≤ n ≤ Threads.nthreads()
global nthreads_add = n
return nothing
end
get_num_threads_add() = nthreads_add
function set_num_threads_svd(n::Int64)
@assert 1 ≤ n ≤ Threads.nthreads()
global nthreads_svd = n
return nothing
end
get_num_threads_svd() = nthreads_svd
function set_num_threads_eigh(n::Int64)
@assert 1 ≤ n ≤ Threads.nthreads()
global nthreads_eigh = n
return nothing
end
get_num_threads_eigh() = nthreads_eigh