You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -522,9 +523,9 @@ function compute_ranges(maxsize)
522
523
return (1:maxsize[1], 1:maxsize[2], 1:maxsize[3])
523
524
end
524
525
525
-
functioncompute_nthreads(maxsize; nthreads_max=NTHREADS_MAX, flatdim=0) # This is a heuristic, which results in (32,8,1) threads, except if maxsize[1] < 32 or maxsize[2] < 8.
526
+
functioncompute_nthreads(maxsize; nthreads_x_max=NTHREADS_X_MAX, nthreads_max=NTHREADS_MAX, flatdim=0) # This is a heuristic, which results in (32,8,1) threads, except if maxsize[1] < 32 or maxsize[2] < 8.
numbertype =get_numbertype(caller) # not :(eltype($(optvars)[1])) # TODO: see how to obtain number type properly for each array: the type of the call call arguments corresponding to the optimization variables should be checked
337
340
dim1 = :(($loopdim==3) ?1: ($loopdim==2) ?1:2) #TODO: to be determined if that is what is desired for loopdim 1 and 2.
@@ -344,11 +347,14 @@ function parallel_call_memopt(caller::Module, ranges::Union{Symbol,Expr}, kernel
determine_loopdim(indices::Union{Symbol,Expr}) =isa(indices,Expr) && (length(indices.args)==3) ?3: LOOPDIM_NONE #TODO: currently only loopdim=3 is supported.
366
-
compute_loopsize() = LOOPSIZE
373
+
compute_loopsize() = LOOPSIZE
367
374
368
375
369
376
## FUNCTIONS TO COMPUTE NTHREADS, NBLOCKS
370
377
371
-
functioncompute_nthreads_memopt(maxsize, loopdim, stencilranges) # This is a heuristic, which results typcially in (32,4,1) threads for a 3-D case.
378
+
functioncompute_nthreads_memopt(nthreads_x_max, nthreads_max_memopt, maxsize, loopdim, stencilranges) # This is a heuristic, which results typcially in (32,4,1) threads for a 3-D case.
if (2*prod(nthreads) <prod(nthreads .+ haloextensions)) @ArgumentError("@parallel <kernelcall>: the automatic determination of nthreads is not possible for this case. Please specify `nthreads` and `nblocks`.") end# NOTE: this is a simple heuristic to compute compare the number of threads to the total number of cells including halo.
@@ -380,10 +387,10 @@ function compute_nthreads_memopt(maxsize, loopdim, stencilranges) # This is a he
Copy file name to clipboardExpand all lines: src/shared.jl
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -15,22 +15,23 @@ Return an expression that evaluates to `true` if the indices generated by @paral
15
15
This macro is not intended for explicit manual usage. Calls to it are automatically added by @parallel where required.
16
16
"""
17
17
18
-
const SUPPORTED_NDIMS = [1, 2, 3]
19
-
const NDIMS_NONE =0
20
-
const ERRMSG_KERNEL_UNSUPPORTED ="unsupported kernel statements in @parallel kernel definition: @parallel is only applicable to kernels that contain exclusively array assignments using macros from FiniteDifferences{1|2|3}D or from another compatible computation submodule. @parallel_indices supports any kind of statements in the kernels."
21
-
const ERRMSG_CHECK_NDIMS ="ndims must be evaluatable at parse time (e.g. literal or constant) and has to be one of the following Integers: $(join(SUPPORTED_NDIMS,", "))"
22
-
const ERRMSG_CHECK_MEMOPT ="memopt must be evaluatable at parse time (e.g. literal or constant) and has to be of type Bool."
const MOD_METADATA =:__metadata__# gensym_world("__metadata__", @__MODULE__) # # TODO: name mangling should be used here later, or if there is any sense to leave it like that then at check whether it's available must be done before creating it
const ERRMSG_KERNEL_UNSUPPORTED ="unsupported kernel statements in @parallel kernel definition: @parallel is only applicable to kernels that contain exclusively array assignments using macros from FiniteDifferences{1|2|3}D or from another compatible computation submodule. @parallel_indices supports any kind of statements in the kernels."
21
+
const ERRMSG_CHECK_NDIMS ="ndims must be evaluatable at parse time (e.g. literal or constant) and has to be one of the following Integers: $(join(SUPPORTED_NDIMS,", "))"
22
+
const ERRMSG_CHECK_MEMOPT ="memopt must be evaluatable at parse time (e.g. literal or constant) and has to be of type Bool."
const MOD_METADATA =:__metadata__# gensym_world("__metadata__", @__MODULE__) # # TODO: name mangling should be used here later, or if there is any sense to leave it like that then at check whether it's available must be done before creating it
0 commit comments