1
- # Copyright (c) 2018-2019 , Intel Corporation
1
+ # Copyright (c) 2018-2024 , Intel Corporation
2
2
#
3
3
# Redistribution and use in source and binary forms, with or without
4
4
# modification, are permitted provided that the following conditions are met:
@@ -391,33 +391,33 @@ cpdef vml_clear_err_status():
391
391
return __vml_clear_err_status()
392
392
393
393
394
- cdef __mkl_status_to_string(int mkl_status):
394
+ cdef str __mkl_status_to_string(int mkl_status) noexcept :
395
395
if mkl_status == 1 :
396
396
return ' success'
397
397
else :
398
398
return ' error'
399
399
400
400
401
- cdef int __python_obj_to_int(obj, func_name):
401
+ cdef int __python_obj_to_int(obj, func_name) except * :
402
402
if not isinstance (obj, numbers.Integral):
403
403
raise ValueError (" The argument of " + func_name + " is expected to be a positive integer" )
404
404
cdef int c_int = < int > obj
405
405
return c_int
406
406
407
407
408
- cdef void __check_positive_num_threads(int p, func_name):
408
+ cdef void __check_positive_num_threads(int p, func_name) except * :
409
409
if p <= 0 :
410
410
warnings.warn(" Non-positive argument of " + func_name +
411
411
" is being ignored, number of threads will not be changed" )
412
412
413
413
414
- cdef void __check_non_negative_num_threads(int p, func_name):
414
+ cdef void __check_non_negative_num_threads(int p, func_name) except * :
415
415
if p < 0 :
416
416
warnings.warn(" Negative argument of " + func_name +
417
417
" is being ignored, number of threads will not be changed" )
418
418
419
419
420
- cdef inline int __mkl_str_to_int(variable, possible_variables_dict):
420
+ cdef inline int __mkl_str_to_int(variable, possible_variables_dict) except * :
421
421
if variable is None :
422
422
raise ValueError (" Variable can not be None" )
423
423
if possible_variables_dict is None :
@@ -429,7 +429,7 @@ cdef inline int __mkl_str_to_int(variable, possible_variables_dict):
429
429
return possible_variables_dict[variable]
430
430
431
431
432
- cdef __mkl_int_to_str(int mkl_int_variable, possible_variables_dict):
432
+ cdef __mkl_int_to_str(int mkl_int_variable, possible_variables_dict) except * :
433
433
if possible_variables_dict is None :
434
434
raise RuntimeError (" Dictionary mapping possible internal code to output string is missing" )
435
435
@@ -441,7 +441,7 @@ cdef __mkl_int_to_str(int mkl_int_variable, possible_variables_dict):
441
441
442
442
443
443
# Version Information
444
- cdef inline mkl.MKLVersion __get_version():
444
+ cdef mkl.MKLVersion __get_version() noexcept :
445
445
"""
446
446
Returns the Intel(R) MKL version.
447
447
"""
@@ -450,7 +450,7 @@ cdef inline mkl.MKLVersion __get_version():
450
450
return c_mkl_version
451
451
452
452
453
- cdef __get_version_string():
453
+ cdef str __get_version_string() except * :
454
454
"""
455
455
Returns the Intel(R) MKL version in a character string.
456
456
"""
@@ -461,7 +461,7 @@ cdef __get_version_string():
461
461
462
462
463
463
# Threading
464
- cdef inline int __set_num_threads(int num_threads):
464
+ cdef inline int __set_num_threads(int num_threads) noexcept :
465
465
"""
466
466
Specifies the number of OpenMP* threads to use.
467
467
"""
@@ -471,15 +471,15 @@ cdef inline int __set_num_threads(int num_threads):
471
471
return prev_num_threads
472
472
473
473
474
- cdef inline int __domain_set_num_threads(int c_num_threads, int mkl_domain):
474
+ cdef inline int __domain_set_num_threads(int c_num_threads, int mkl_domain) noexcept :
475
475
"""
476
476
Specifies the number of OpenMP* threads for a particular function domain.
477
477
"""
478
478
cdef int mkl_status = mkl.mkl_domain_set_num_threads(c_num_threads, mkl_domain)
479
479
return mkl_status
480
480
481
481
482
- cdef inline int __set_num_threads_local(int c_num_threads):
482
+ cdef inline int __set_num_threads_local(int c_num_threads) noexcept :
483
483
"""
484
484
Specifies the number of OpenMP* threads for all Intel(R) MKL functions on the current execution thread.
485
485
"""
@@ -488,7 +488,7 @@ cdef inline int __set_num_threads_local(int c_num_threads):
488
488
return c_mkl_status
489
489
490
490
491
- cdef inline int __set_dynamic(int c_enable):
491
+ cdef inline int __set_dynamic(int c_enable) noexcept :
492
492
"""
493
493
Enables Intel(R) MKL to dynamically change the number of OpenMP* threads.
494
494
"""
@@ -497,14 +497,14 @@ cdef inline int __set_dynamic(int c_enable):
497
497
return __get_max_threads()
498
498
499
499
500
- cdef inline int __get_max_threads():
500
+ cdef inline int __get_max_threads() noexcept :
501
501
"""
502
502
Gets the number of OpenMP* threads targeted for parallelism.
503
503
"""
504
504
return mkl.mkl_get_max_threads()
505
505
506
506
507
- cdef inline int __domain_get_max_threads(int c_mkl_domain):
507
+ cdef inline int __domain_get_max_threads(int c_mkl_domain) noexcept :
508
508
"""
509
509
Gets the number of OpenMP* threads targeted for parallelism for a particular function domain.
510
510
"""
@@ -513,15 +513,15 @@ cdef inline int __domain_get_max_threads(int c_mkl_domain):
513
513
return c_num_threads
514
514
515
515
516
- cdef inline int __get_dynamic():
516
+ cdef inline int __get_dynamic() noexcept :
517
517
"""
518
518
Determines whether Intel(R) MKL is enabled to dynamically change the number of OpenMP* threads.
519
519
"""
520
520
return mkl.mkl_get_dynamic()
521
521
522
522
523
523
# Timing
524
- cdef inline float __second():
524
+ cdef inline float __second() noexcept :
525
525
"""
526
526
Returns elapsed time in seconds.
527
527
Use to estimate real time between two calls to this function.
@@ -530,7 +530,7 @@ cdef inline float __second():
530
530
return mkl.second()
531
531
532
532
533
- cdef inline double __dsecnd():
533
+ cdef inline double __dsecnd() noexcept :
534
534
"""
535
535
Returns elapsed time in seconds.
536
536
Use to estimate real time between two calls to this function.
@@ -539,7 +539,7 @@ cdef inline double __dsecnd():
539
539
return mkl.dsecnd()
540
540
541
541
542
- cdef inline mkl.MKL_UINT64 __get_cpu_clocks():
542
+ cdef inline mkl.MKL_UINT64 __get_cpu_clocks() noexcept :
543
543
"""
544
544
Returns elapsed CPU clocks.
545
545
"""
@@ -548,52 +548,52 @@ cdef inline mkl.MKL_UINT64 __get_cpu_clocks():
548
548
return clocks
549
549
550
550
551
- cdef inline double __get_cpu_frequency():
551
+ cdef inline double __get_cpu_frequency() noexcept :
552
552
"""
553
553
Returns the current CPU frequency value in GHz.
554
554
"""
555
555
return mkl.mkl_get_cpu_frequency()
556
556
557
557
558
- cdef inline double __get_max_cpu_frequency():
558
+ cdef inline double __get_max_cpu_frequency() noexcept :
559
559
"""
560
560
Returns the maximum CPU frequency value in GHz.
561
561
"""
562
562
return mkl.mkl_get_max_cpu_frequency()
563
563
564
564
565
- cdef inline double __get_clocks_frequency():
565
+ cdef inline double __get_clocks_frequency() noexcept :
566
566
"""
567
567
Returns the frequency value in GHz based on constant-rate Time Stamp Counter.
568
568
"""
569
569
return mkl.mkl_get_clocks_frequency()
570
570
571
571
572
572
# Memory Management. See the Intel(R) MKL Developer Guide for more memory usage information.
573
- cdef inline void __free_buffers():
573
+ cdef inline void __free_buffers() noexcept :
574
574
"""
575
575
Frees unused memory allocated by the Intel(R) MKL Memory Allocator.
576
576
"""
577
577
mkl.mkl_free_buffers()
578
578
return
579
579
580
580
581
- cdef inline void __thread_free_buffers():
581
+ cdef inline void __thread_free_buffers() noexcept :
582
582
"""
583
583
Frees unused memory allocated by the Intel(R) MKL Memory Allocator in the current thread.
584
584
"""
585
585
mkl.mkl_thread_free_buffers()
586
586
return
587
587
588
588
589
- cdef inline int __disable_fast_mm():
589
+ cdef inline int __disable_fast_mm() noexcept :
590
590
"""
591
591
Turns off the Intel(R) MKL Memory Allocator for Intel(R) MKL functions to directly use the system malloc/free functions.
592
592
"""
593
593
return mkl.mkl_disable_fast_mm()
594
594
595
595
596
- cdef inline MemStatData __mem_stat():
596
+ cdef inline MemStatData __mem_stat() noexcept :
597
597
"""
598
598
Reports the status of the Intel(R) MKL Memory Allocator.
599
599
"""
@@ -602,7 +602,7 @@ cdef inline MemStatData __mem_stat():
602
602
return mem_stat_data
603
603
604
604
605
- cdef object __peak_mem_usage(mem_const):
605
+ cdef object __peak_mem_usage(mem_const) except * :
606
606
"""
607
607
Reports the peak memory allocated by the Intel(R) MKL Memory Allocator.
608
608
"""
@@ -625,7 +625,7 @@ cdef object __peak_mem_usage(mem_const):
625
625
return memory_allocator
626
626
627
627
628
- cdef inline object __set_memory_limit(limit):
628
+ cdef inline object __set_memory_limit(limit) except * :
629
629
"""
630
630
On Linux, sets the limit of memory that Intel(R) MKL can allocate for a specified type of memory.
631
631
"""
@@ -636,7 +636,7 @@ cdef inline object __set_memory_limit(limit):
636
636
637
637
638
638
# Conditional Numerical Reproducibility
639
- cdef object __cbwr_set(branch = None ):
639
+ cdef object __cbwr_set(branch = None ) except * :
640
640
"""
641
641
Configures the CNR mode of Intel(R) MKL.
642
642
"""
@@ -676,7 +676,7 @@ cdef object __cbwr_set(branch=None):
676
676
return status
677
677
678
678
679
- cdef inline __cbwr_get(cnr_const = None ):
679
+ cdef inline __cbwr_get(cnr_const = None ) except * :
680
680
"""
681
681
Returns the current CNR settings.
682
682
"""
@@ -714,7 +714,7 @@ cdef inline __cbwr_get(cnr_const=None):
714
714
return status
715
715
716
716
717
- cdef object __cbwr_get_auto_branch():
717
+ cdef object __cbwr_get_auto_branch() except * :
718
718
"""
719
719
Automatically detects the CNR code branch for your platform.
720
720
"""
@@ -749,7 +749,7 @@ cdef object __cbwr_get_auto_branch():
749
749
750
750
751
751
# Miscellaneous
752
- cdef object __enable_instructions(isa = None ):
752
+ cdef object __enable_instructions(isa = None ) except * :
753
753
"""
754
754
Enables dispatching for new Intel architectures or restricts the set of Intel instruction sets available for dispatching.
755
755
"""
@@ -776,7 +776,7 @@ cdef object __enable_instructions(isa=None):
776
776
return __mkl_status_to_string(c_mkl_status)
777
777
778
778
779
- cdef object __set_env_mode():
779
+ cdef object __set_env_mode() except * :
780
780
"""
781
781
Sets up the mode that ignores environment settings specific to Intel(R) MKL. See mkl_set_env_mode(1).
782
782
"""
@@ -793,7 +793,7 @@ cdef object __set_env_mode():
793
793
return status
794
794
795
795
796
- cdef object __get_env_mode():
796
+ cdef object __get_env_mode() except * :
797
797
"""
798
798
Query the current environment mode. See mkl_set_env_mode(0).
799
799
"""
@@ -809,14 +809,14 @@ cdef object __get_env_mode():
809
809
return status
810
810
811
811
812
- cdef inline int __verbose(int c_enable):
812
+ cdef inline int __verbose(int c_enable) noexcept :
813
813
"""
814
814
Enables or disables Intel(R) MKL Verbose mode.
815
815
"""
816
816
return mkl.mkl_verbose(c_enable)
817
817
818
818
819
- cdef __set_mpi(vendor, custom_library_name = None ):
819
+ cdef __set_mpi(vendor, custom_library_name = None ) except * :
820
820
"""
821
821
Sets the implementation of the message-passing interface to be used by Intel(R) MKL.
822
822
"""
@@ -854,7 +854,7 @@ cdef __set_mpi(vendor, custom_library_name=None):
854
854
855
855
856
856
# VM Service Functions
857
- cdef object __vml_set_mode(accuracy, ftzdaz, errmode):
857
+ cdef object __vml_set_mode(accuracy, ftzdaz, errmode) except * :
858
858
"""
859
859
Sets a new mode for VM functions according to the mode parameter and stores the previous VM mode to oldmode.
860
860
"""
@@ -919,7 +919,7 @@ cdef object __vml_set_mode(accuracy, ftzdaz, errmode):
919
919
return (accuracy, ftzdaz, errmode)
920
920
921
921
922
- cdef object __vml_get_mode():
922
+ cdef object __vml_get_mode() except * :
923
923
"""
924
924
Gets the VM mode.
925
925
"""
@@ -972,7 +972,7 @@ __mkl_vml_status = {
972
972
}
973
973
974
974
975
- cdef object __vml_set_err_status(status):
975
+ cdef object __vml_set_err_status(status) except * :
976
976
"""
977
977
Sets the new VM Error Status according to err and stores the previous VM Error Status to olderr.
978
978
"""
@@ -1006,7 +1006,7 @@ cdef object __vml_set_err_status(status):
1006
1006
return status
1007
1007
1008
1008
1009
- cdef object __vml_get_err_status():
1009
+ cdef object __vml_get_err_status() except * :
1010
1010
"""
1011
1011
Gets the VM Error Status.
1012
1012
"""
@@ -1030,7 +1030,7 @@ cdef object __vml_get_err_status():
1030
1030
return status
1031
1031
1032
1032
1033
- cdef object __vml_clear_err_status():
1033
+ cdef object __vml_clear_err_status() except * :
1034
1034
"""
1035
1035
Sets the VM Error Status to VML_STATUS_OK and stores the previous VM Error Status to olderr.
1036
1036
"""
0 commit comments