"src/include/blockwise_gemm.hpp" did not exist on "05d7a0875c8e4cd12aed8e63100591ed07328d6a"
Commit 07acd53b authored by carlushuang's avatar carlushuang
Browse files

let control core binding

parent f9cf57d4
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#define TEST_LAYOUT_NHWC_KYXC_NHWK 0 #define TEST_LAYOUT_NHWC_KYXC_NHWK 0
#define TEST_LAYOUT_NHWC_KYXCK8_NHWK 1 #define TEST_LAYOUT_NHWC_KYXCK8_NHWK 1
#define TEST_LAYOUT_NHWC_YXCK_NHWK 1 #define TEST_LAYOUT_NHWC_YXCK_NHWK 2
#define TEST_LAYOUT TEST_LAYOUT_NHWC_KYXC_NHWK #define TEST_LAYOUT TEST_LAYOUT_NHWC_YXCK_NHWK
using F32 = float; using F32 = float;
using F16 = ck::half_t; using F16 = ck::half_t;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "threadwise_tensor_slice_transfer_avx2.hpp" #include "threadwise_tensor_slice_transfer_avx2.hpp"
#include "threadwise_tensor_slice_transfer_avx2_specialization.hpp" #include "threadwise_tensor_slice_transfer_avx2_specialization.hpp"
#include "dynamic_buffer_cpu.hpp" #include "dynamic_buffer_cpu.hpp"
#include "envvar.hpp"
#include <utility> #include <utility>
#include <unistd.h> #include <unistd.h>
#include <omp.h> #include <omp.h>
...@@ -303,8 +304,8 @@ struct GridwiseGemmAvx2_MxN ...@@ -303,8 +304,8 @@ struct GridwiseGemmAvx2_MxN
int total_threads = omp_get_max_threads(); int total_threads = omp_get_max_threads();
#if 0 if(total_threads > 1 && ck::getenv_int("CK_CPU_BIND_CORE", 1) != 0)
if(total_threads > 1){ {
#pragma omp parallel #pragma omp parallel
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
...@@ -313,12 +314,12 @@ struct GridwiseGemmAvx2_MxN ...@@ -313,12 +314,12 @@ struct GridwiseGemmAvx2_MxN
CPU_SET(tid, &set); CPU_SET(tid, &set);
if (sched_setaffinity(0, sizeof(set), &set) == -1) { if(sched_setaffinity(0, sizeof(set), &set) == -1)
{
throw std::runtime_error("wrong! fail to set thread affinity"); throw std::runtime_error("wrong! fail to set thread affinity");
} }
} }
} }
#endif
// TODO: openmp aware ordering // TODO: openmp aware ordering
// //
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "threadwise_tensor_slice_transfer_avx2.hpp" #include "threadwise_tensor_slice_transfer_avx2.hpp"
#include "threadwise_tensor_slice_transfer_avx2_specialization.hpp" #include "threadwise_tensor_slice_transfer_avx2_specialization.hpp"
#include "dynamic_buffer_cpu.hpp" #include "dynamic_buffer_cpu.hpp"
#include "envvar.hpp"
#include <utility> #include <utility>
#include <unistd.h> #include <unistd.h>
#include <omp.h> #include <omp.h>
...@@ -329,8 +330,8 @@ struct GridwiseGemmBiasActivationAddAvx2_MxN ...@@ -329,8 +330,8 @@ struct GridwiseGemmBiasActivationAddAvx2_MxN
int total_threads = omp_get_max_threads(); int total_threads = omp_get_max_threads();
#if 0 if(total_threads > 1 && ck::getenv_int("CK_CPU_BIND_CORE", 1) != 0)
if(total_threads > 1){ {
#pragma omp parallel #pragma omp parallel
{ {
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
...@@ -339,12 +340,12 @@ struct GridwiseGemmBiasActivationAddAvx2_MxN ...@@ -339,12 +340,12 @@ struct GridwiseGemmBiasActivationAddAvx2_MxN
CPU_SET(tid, &set); CPU_SET(tid, &set);
if (sched_setaffinity(0, sizeof(set), &set) == -1) { if(sched_setaffinity(0, sizeof(set), &set) == -1)
{
throw std::runtime_error("wrong! fail to set thread affinity"); throw std::runtime_error("wrong! fail to set thread affinity");
} }
} }
} }
#endif
// TODO: openmp aware ordering // TODO: openmp aware ordering
// //
......
#ifndef __ENVVAR_HPP
#define __ENVVAR_HPP
#include <cstdlib>
namespace ck {
static inline int getenv_int(const char* var_name, int default_int)
{
char* v = ::getenv(var_name);
int r = default_int;
if(v)
r = ::atoi(v);
return r;
}
static inline char* getenv_str(const char* var_name, char* default_str)
{
char* v = ::getenv(var_name);
if(v)
return v;
return default_str;
}
} // namespace ck
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment