Skip to content

Commit

Permalink
Merge pull request #22 from IntelPython/tc/getnthreads
Browse files Browse the repository at this point in the history
adding num_threads()
  • Loading branch information
fschlimb committed Dec 5, 2018
2 parents aaafc58 + ec034ab commit 082057e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions generator/wrapper_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def __dealloc__(self):
cdef extern from "daal4py_cpp.h":
cdef void c_daalinit(int nthreads) except +
cdef void c_daalfini() except +
cdef size_t c_num_threads() except +
cdef size_t c_num_procs() except +
cdef size_t c_my_procid() except +
Expand All @@ -144,6 +145,9 @@ def daalinit(nthreads = -1):
def daalfini():
c_daalfini()
def num_threads():
return c_num_threads()
def num_procs():
return c_num_procs()
Expand Down
6 changes: 6 additions & 0 deletions src/daal4py.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ void c_daalfini()
#endif
}

size_t c_num_threads()
{
return daal::services::Environment::getInstance()->getNumberOfThreads();
}


size_t c_num_procs()
{
#ifdef _DIST_
Expand Down
1 change: 1 addition & 0 deletions src/daal4py.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ using daal::services::LibraryVersionInfo;
extern "C" {
void c_daalinit(int nthreads=-1);
void c_daalfini();
size_t c_num_threads();
size_t c_num_procs();
size_t c_my_procid();
}
Expand Down

0 comments on commit 082057e

Please sign in to comment.