projects
/
platform
/
upstream
/
caffeonacl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8cd5c3d
)
Use mkl_malloc when use mkl
author
Tomasz Socha
<tomasz.socha@intel.com>
Thu, 8 Dec 2016 13:51:30 +0000
(14:51 +0100)
committer
Tomasz Socha
<tomasz.socha@intel.com>
Wed, 21 Dec 2016 12:19:24 +0000
(13:19 +0100)
include/caffe/syncedmem.hpp
patch
|
blob
|
history
diff --git
a/include/caffe/syncedmem.hpp
b/include/caffe/syncedmem.hpp
index
38ee466
..
6474a69
100644
(file)
--- a/
include/caffe/syncedmem.hpp
+++ b/
include/caffe/syncedmem.hpp
@@
-3,6
+3,10
@@
#include <cstdlib>
+#ifdef USE_MKL
+ #include "mkl.h"
+#endif
+
#include "caffe/common.hpp"
namespace caffe {
@@
-20,7
+24,11
@@
inline void CaffeMallocHost(void** ptr, size_t size, bool* use_cuda) {
return;
}
#endif
+#ifdef USE_MKL
+ *ptr = mkl_malloc(size ? size:1, 64);
+#else
*ptr = malloc(size);
+#endif
*use_cuda = false;
CHECK(*ptr) << "host allocation of size " << size << " failed";
}
@@
-32,7
+40,11
@@
inline void CaffeFreeHost(void* ptr, bool use_cuda) {
return;
}
#endif
+#ifdef USE_MKL
+ mkl_free(ptr);
+#else
free(ptr);
+#endif
}