From d3199ab2ef4357b7f54ab5e40827d8d8bd78b168 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Mon, 1 Nov 2021 15:01:11 -0500 Subject: [PATCH 1/2] Add mkl.MKL_BLACS_LASTMPI Used it to conditional use mkl.MKL_BLACS_MPICH2 which may not exist on Windows --- mkl/_mkl_service.pxd | 1 + mkl/_mkl_service.pyx | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mkl/_mkl_service.pxd b/mkl/_mkl_service.pxd index 7768f29..e11f659 100644 --- a/mkl/_mkl_service.pxd +++ b/mkl/_mkl_service.pxd @@ -91,6 +91,7 @@ cdef extern from "mkl.h": int MKL_BLACS_MSMPI int MKL_BLACS_INTELMPI int MKL_BLACS_MPICH2 + int MKL_BLACS_LASTMPI # VML Constants int VML_HA diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index 8246f00..7a0b450 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -874,7 +874,6 @@ cdef __set_mpi(vendor, custom_library_name=None): 'custom': mkl.MKL_BLACS_CUSTOM, 'msmpi': mkl.MKL_BLACS_MSMPI, 'intelmpi': mkl.MKL_BLACS_INTELMPI, - 'mpich2': mkl.MKL_BLACS_MPICH2, }, 'output': { 0: 'success', @@ -883,6 +882,8 @@ cdef __set_mpi(vendor, custom_library_name=None): -3: 'MPI library cannot be set at this point', }, } + if mkl.MKL_BLACS_LASTMPI > mkl.MKL_BLACS_INTELMPI + 1: + __variables['input']['mpich2'] = mkl.MKL_BLACS_MPICH2 if ((vendor is 'custom' or custom_library_name is not None) and (vendor is not 'custom' or custom_library_name is None)): raise ValueError("Selecting custom MPI for BLACS requires specifying " -- 2.32.1 (Apple Git-133) From 881717cba6152eb41304111456be26a49562be51 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 5 Nov 2021 11:38:08 -0500 Subject: [PATCH 2/2] Fixed typo, defined MKL_BLACS_MPICH2 to -1 if undefined --- mkl/_mkl_service.pyx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mkl/_mkl_service.pyx b/mkl/_mkl_service.pyx index 7a0b450..62e071c 100644 --- a/mkl/_mkl_service.pyx +++ b/mkl/_mkl_service.pyx @@ -31,6 +31,14 @@ import warnings cimport mkl._mkl_service as mkl +cdef extern from *: + """ + /* defind MKL_BLACS_MPICH2 if undefined */ + #ifndef MKL_BLACS_MPICH2 + #define MKL_BLACS_MPICH2 -1 + #endif + """ + ctypedef struct MemStatData: # DataAllocatedBytes, AllocatedBuffers mkl.MKL_INT64 allocated_bytes -- 2.32.1 (Apple Git-133)