"megatron/model/vscode:/vscode.git/clone" did not exist on "3aca141586a4b8cdc983c3ecf5f7baf60506c7f8"
utils.h 346 Bytes
Newer Older
1
#pragma once
lishen's avatar
lishen committed
2
3
4
5
6
7
8
9

#include "check.h"
#include <stdint.h>
#include <time.h>
#include <sched.h>
#include <new>

namespace sccl {
10
11
12
13
14
15
static inline void thread_bind_cpu(int coreid) {
    cpu_set_t cpuset;
    CPU_ZERO(&cpuset);
    CPU_SET(coreid, &cpuset);
    pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
}
16
////
lishen's avatar
lishen committed
17
} // namespace sccl