Skip to content

Commit 6340a0f

Browse files
committed
tests for the set/get of num-threads and denormal modes
1 parent 58b531d commit 6340a0f

File tree

2 files changed

+35
-21
lines changed

2 files changed

+35
-21
lines changed

src/setup.jl

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -123,27 +123,6 @@ const VML_NUM_THREADS_OMP_MASK = 0x00030000
123123
const VML_FTZDAZ_MASK = 0x003C0000
124124
const VML_TRAP_EXCEPTIONS_MASK = 0x0F000000
125125

126-
127-
# mkl\include\mkl_vml_defines.h
128-
# ERROR STATUS MACROS
129-
# VML_STATUS_OK - no errors
130-
# VML_STATUS_BADSIZE - array dimension is not positive
131-
# VML_STATUS_BADMEM - invalid pointer passed
132-
# VML_STATUS_ERRDOM - at least one of arguments is out of function domain
133-
# VML_STATUS_SING - at least one of arguments caused singularity
134-
# VML_STATUS_OVERFLOW - at least one of arguments caused overflow
135-
# VML_STATUS_UNDERFLOW - at least one of arguments caused underflow
136-
# VML_STATUS_ACCURACYWARNING - function doesn't support set accuracy mode,
137-
# lower accuracy mode was used instead
138-
const VML_STATUS_OK = 0
139-
const VML_STATUS_BADSIZE = -1
140-
const VML_STATUS_BADMEM = -2
141-
const VML_STATUS_ERRDOM = 1
142-
const VML_STATUS_SING = 2
143-
const VML_STATUS_OVERFLOW = 3
144-
const VML_STATUS_UNDERFLOW = 4
145-
const VML_STATUS_ACCURACYWARNING = 1000
146-
147126
# https://www.intel.com/content/www/us/en/develop/documentation/onemkl-developer-reference-c/top/vector-mathematical-functions/vm-service-functions.html
148127
vml_get_mode() = ccall((:vmlGetMode, MKL_jll.libmkl_rt), Cuint, ())
149128
vml_set_mode(mode::Integer) = (ccall((:vmlSetMode, MKL_jll.libmkl_rt), Cuint, (UInt,), mode); nothing)
@@ -236,6 +215,26 @@ vml_get_max_cpu_frequency() = ccall((:MKL_Get_Max_Cpu_Frequency, MKL_jll.libmkl_
236215

237216
# -----------------------------------------------------------------------------------------------
238217

218+
# mkl\include\mkl_vml_defines.h
219+
# ERROR STATUS MACROS
220+
# VML_STATUS_OK - no errors
221+
# VML_STATUS_BADSIZE - array dimension is not positive
222+
# VML_STATUS_BADMEM - invalid pointer passed
223+
# VML_STATUS_ERRDOM - at least one of arguments is out of function domain
224+
# VML_STATUS_SING - at least one of arguments caused singularity
225+
# VML_STATUS_OVERFLOW - at least one of arguments caused overflow
226+
# VML_STATUS_UNDERFLOW - at least one of arguments caused underflow
227+
# VML_STATUS_ACCURACYWARNING - function doesn't support set accuracy mode,
228+
# lower accuracy mode was used instead
229+
const VML_STATUS_OK = 0
230+
const VML_STATUS_BADSIZE = -1
231+
const VML_STATUS_BADMEM = -2
232+
const VML_STATUS_ERRDOM = 1
233+
const VML_STATUS_SING = 2
234+
const VML_STATUS_OVERFLOW = 3
235+
const VML_STATUS_UNDERFLOW = 4
236+
const VML_STATUS_ACCURACYWARNING = 1000
237+
239238
function vml_check_error()
240239
vml_error = ccall((:vmlClearErrStatus, MKL_jll.libmkl_rt), Cint, ())
241240
if vml_error != VML_STATUS_OK

test/real.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,19 @@ end
5858
vml_set_accuracy(VML_EP)
5959
Test.@test vml_get_accuracy() == VML_EP
6060

61+
# Setting denormal
62+
vml_set_denormalmode(VML_DENORMAL_FAST)
63+
Test.@test vml_get_denormalmode() == VML_DENORMAL_FAST
64+
65+
vml_set_denormalmode(VML_DENORMAL_ACCURATE)
66+
Test.@test vml_get_denormalmode() == VML_DENORMAL_ACCURATE
67+
68+
# Setting number of threads (should have at least one 1)
69+
Test.@test vml_set_num_threads(1)
70+
Test.@test !vml_set_num_threads(-1)
71+
Test.@test vml_get_max_threads() == 1
72+
73+
Test.@test vml_set_num_threads(0)
74+
Test.@test vml_get_max_threads() >= 1
75+
6176
end

0 commit comments

Comments
 (0)