Skip to content

Commit

Permalink
Merge pull request BVLC#5075 from tsocha/master
Browse files Browse the repository at this point in the history
Fix mkl issue BVLC#4836
  • Loading branch information
cypof authored Jan 14, 2017
2 parents 8314363 + 2fac0d6 commit 0a91794
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/caffe/syncedmem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

#include <cstdlib>

#ifdef USE_MKL
#include "mkl.h"
#endif

#include "caffe/common.hpp"

namespace caffe {
Expand All @@ -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";
}
Expand All @@ -32,7 +40,11 @@ inline void CaffeFreeHost(void* ptr, bool use_cuda) {
return;
}
#endif
#ifdef USE_MKL
mkl_free(ptr);
#else
free(ptr);
#endif
}


Expand Down

0 comments on commit 0a91794

Please sign in to comment.