Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ jobs:
- uses: actions/checkout@master
- uses: reviewdog/action-cpplint@master
with:
github_token: ${{ secrets.github_token }}
github_token: ${{ secrets.github_token }}
args: --linelength=120
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ if(GIT_FOUND)
#string(REPLACE "." "_" GIT_BRANCH ${GIT_BRANCH})
string(REPLACE "-" "_" GIT_BRANCH ${GIT_BRANCH})
string(REPLACE "/" "_" GIT_BRANCH ${GIT_BRANCH})
message(STATUS "Git formated branch is ${GIT_BRANCH}")
message(STATUS "Git formatted branch is ${GIT_BRANCH}")
endif()

# Generate the static config header file
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ English | [中文](README_CN.md)

## Introduction

HAMi-core is the in-container gpu resource controller, it has beed adopted by [HAMi](https://github.com/Project-HAMi/HAMi), [volcano](https://github.com/volcano-sh/devices)
HAMi-core is the in-container gpu resource controller, it has been adopted by [HAMi](https://github.com/Project-HAMi/HAMi), [volcano](https://github.com/volcano-sh/devices)

<img src="./docs/images/hami-arch.png" width = "600" />

## Features

HAMi-core has the following features:
1. Virtualize device meory
1. Virtualize device memory
2. Limit device utilization by self-implemented time shard
3. Real-time device utilization monitor

Expand Down
4 changes: 2 additions & 2 deletions src/cuda/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
cuda_entry_t cuda_library_entry[] = {
/* Init Part */
{.name = "cuInit"},
/* Deivce Part */
/* Device Part */
{.name = "cuDeviceGetAttribute"},
{.name = "cuDeviceGet"},
{.name = "cuDeviceGetCount"},
Expand Down Expand Up @@ -328,7 +328,7 @@
const char *real_symbol;
real_symbol = get_real_func_name(symbol,cudaVersion);
if (real_symbol == NULL) {
// if not find in mulit func version def, use origin logic
// if not find in multi func version def, use origin logic

Check failure on line 331 in src/cuda/hook.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing space after , [whitespace/comma] [3] Raw Output: src/cuda/hook.c:331: Missing space after , [whitespace/comma] [3]
pfn = find_symbols_in_table(symbol);
} else {
pfn = find_real_symbols_in_table(real_symbol);
Expand Down
14 changes: 7 additions & 7 deletions src/cuda/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}
bytes *= cuarray_format_bytes[desc->Format];

// TODO: take acount of alignment and etc
// TODO: take account of alignment and etc

Check failure on line 71 in src/cuda/memory.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2] Raw Output: src/cuda/memory.c:71: Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2]
// bytes ++ ???
return bytes;
}
Expand All @@ -87,7 +87,7 @@
}
bytes *= cuarray_format_bytes[desc->Format];

// TODO: take acount of alignment and etc
// TODO: take account of alignment and etc

Check failure on line 90 in src/cuda/memory.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2] Raw Output: src/cuda/memory.c:90: Missing username in TODO; it should look like "// TODO(my_username): Stuff." [readability/todo] [2]
// bytes ++ ???
return bytes;
}
Expand Down Expand Up @@ -118,7 +118,7 @@

CUresult cuArrayDestroy(CUarray arr) {
CUDA_ARRAY3D_DESCRIPTOR desc;
LOG_DEBUG("cuArrayDestory");
LOG_DEBUG("cuArrayDestroy");
CHECK_DRV_API(cuArray3DGetDescriptor(&desc, arr));
/*uint64_t bytes*/
compute_3d_array_alloc_bytes(&desc);
Expand Down Expand Up @@ -283,14 +283,14 @@
}

CUresult cuPointerGetAttribute ( void* data, CUpointer_attribute attribute, CUdeviceptr ptr ){
LOG_DEBUG("cuPointGetAttribue data=%p attribute=%d ptr=%llx",data,(int)attribute,ptr);
LOG_DEBUG("cuPointGetAttribute data=%p attribute=%d ptr=%llx", data, (int)attribute,ptr);

Check failure on line 286 in src/cuda/memory.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing space after , [whitespace/comma] [3] Raw Output: src/cuda/memory.c:286: Missing space after , [whitespace/comma] [3]
ENSURE_RUNNING();
CUresult res = CUDA_OVERRIDE_CALL(cuda_library_entry,cuPointerGetAttribute,data,attribute,ptr);
return res;
}

CUresult cuPointerGetAttributes ( unsigned int numAttributes, CUpointer_attribute* attributes, void** data, CUdeviceptr ptr ) {
LOG_DEBUG("cuPointGetAttribue data=%p ptr=%llx",data,ptr);
LOG_DEBUG("cuPointGetAttribute data=%p ptr=%llx", data, ptr);

Check failure on line 293 in src/cuda/memory.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing space after , [whitespace/comma] [3] Raw Output: src/cuda/memory.c:293: Missing space after , [whitespace/comma] [3]
ENSURE_RUNNING();
CUresult res = CUDA_OVERRIDE_CALL(cuda_library_entry,cuPointerGetAttributes,numAttributes,attributes,data,ptr);
int cur=0;
Expand All @@ -309,7 +309,7 @@
}

CUresult cuPointerSetAttribute ( const void* value, CUpointer_attribute attribute, CUdeviceptr ptr ){
LOG_DEBUG("cuPointSetAttribue value=%p attribute=%d ptr=%llx",value,(int)attribute,ptr);
LOG_DEBUG("cuPointSetAttribute value=%p attribute=%d ptr=%llx", value, (int)attribute, ptr);

Check failure on line 312 in src/cuda/memory.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing space after , [whitespace/comma] [3] Raw Output: src/cuda/memory.c:312: Missing space after , [whitespace/comma] [3]
ENSURE_RUNNING();
CUresult res = CUDA_OVERRIDE_CALL(cuda_library_entry,cuPointerSetAttribute,value,attribute,ptr);
return res;
Expand Down Expand Up @@ -537,7 +537,7 @@

CUresult cuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray) {
// TODO: compute bytesize
LOG_DEBUG("cuMipmappedArrayDestory\n");
LOG_DEBUG("cuMipmappedArrayDestroy\n");
CUresult res = CUDA_OVERRIDE_CALL(cuda_library_entry,cuMipmappedArrayDestroy, hMipmappedArray);
return res;
}
Expand Down
2 changes: 1 addition & 1 deletion src/cuda/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}

CUresult cuStreamDestroy_v2 ( CUstream hStream ){
LOG_DEBUG("cuStreamDestory_v2 %p",hStream);
LOG_DEBUG("cuStreamDestroy_v2 %p",hStream);

Check failure on line 10 in src/cuda/stream.c

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Missing space after , [whitespace/comma] [3] Raw Output: src/cuda/stream.c:10: Missing space after , [whitespace/comma] [3]
return CUDA_OVERRIDE_CALL(cuda_library_entry,cuStreamDestroy_v2,hStream);
}

Expand Down
2 changes: 1 addition & 1 deletion src/include/libcuda_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef CUresult (*cuda_sym_t)();
typedef enum {
/* cuInit Part */
CUDA_OVERRIDE_ENUM(cuInit),
/* cuDeivce Part */
/* cuDevice Part */
CUDA_OVERRIDE_ENUM(cuDeviceGetAttribute),
CUDA_OVERRIDE_ENUM(cuDeviceGet),
CUDA_OVERRIDE_ENUM(cuDeviceGetCount),
Expand Down
8 changes: 4 additions & 4 deletions src/include/nvml-subset.h
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ typedef enum nvmlGpuP2PCapsIndex_enum {
/* P2P Capability Index Status*/
typedef enum nvmlGpuP2PStatus_enum {
NVML_P2P_STATUS_OK = 0,
NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED,
NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED,
NVML_P2P_STATUS_GPU_NOT_SUPPORTED,
NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED,
NVML_P2P_STATUS_DISABLED_BY_REGKEY,
Expand Down Expand Up @@ -808,7 +808,7 @@ typedef struct nvmlVgpuPgpuMetadata_st {
char hostDriverVersion
[NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE]; //!< Host driver version
unsigned int
pgpuVirtualizationCaps; //!< Pgpu virtualizaion capabilities bitfileld
pgpuVirtualizationCaps; //!< Pgpu virtualization capabilities bitfield
unsigned int reserved[7]; //!< Reserved for internal use
unsigned int opaqueDataSize; //!< Size of opaque data field in bytes
char opaqueData[4]; //!< Opaque data
Expand Down Expand Up @@ -966,7 +966,7 @@ typedef enum nvmlVgpuVmCompatibility_enum {
NVML_VGPU_VM_COMPATIBILITY_HIBERNATE =
0x2, //!< vGPU is runnable from a hibernated state (ACPI S4)
NVML_VGPU_VM_COMPATIBILITY_SLEEP =
0x4, //!< vGPU is runnable from a sleeped state (ACPI S3)
0x4, //!< vGPU is runnable from a slept state (ACPI S3)
NVML_VGPU_VM_COMPATIBILITY_LIVE =
0x8, //!< vGPU is runnable from a live/paused (ACPI S0)
} nvmlVgpuVmCompatibility_t;
Expand Down Expand Up @@ -1093,7 +1093,7 @@ typedef enum nvmlVgpuVmIdType {
* Represents frame buffer capture session type
*/
typedef enum nvmlFBCSessionType_enum {
NVML_FBC_SESSION_TYPE_UNKNOWN = 0, //!< Unknwon
NVML_FBC_SESSION_TYPE_UNKNOWN = 0, //!< Unknown
NVML_FBC_SESSION_TYPE_TOSYS, //!< ToSys
NVML_FBC_SESSION_TYPE_CUDA, //!< Cuda
NVML_FBC_SESSION_TYPE_VID, //!< Vid
Expand Down
4 changes: 2 additions & 2 deletions src/multiprocess/multiprocess_memory_limit.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ int fix_lock_shrreg() {
if (current_owner != 0) {
int flag = 0;
if (current_owner == region_info.pid) {
LOG_INFO("Detect onwer pid = self pid (%d), "
LOG_INFO("Detect owner pid = self pid (%d), "
"indicates pid loopback or race condition", current_owner);
flag = 1;
} else {
Expand Down Expand Up @@ -568,7 +568,7 @@ void init_proc_slot_withlock() {
}
signal(SIGUSR2,sig_swap_stub);
signal(SIGUSR1,sig_restore_stub);
// If, by any means a pid of itself is found in region->proces, then it is probably caused by crashloop
// If, by any means a pid of itself is found in region->process, then it is probably caused by crashloop
// we need to reset it.
int i,found=0;
for (i=0; i<region->proc_num; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/multiprocess/multiprocess_memory_limit.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@

//Setspec of the corresponding device
int setspec();
//Remove quitted process
//Remove quit process

Check failure on line 168 in src/multiprocess/multiprocess_memory_limit.h

View workflow job for this annotation

GitHub Actions / cpplint

[cpplint] reported by reviewdog 🐶 Should have a space between // and comment [whitespace/comments] [4] Raw Output: src/multiprocess/multiprocess_memory_limit.h:168: Should have a space between // and comment [whitespace/comments] [4]

void suspend_all();
void resume_all();
Expand Down
Loading