Skip to content
Closed
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ _CUDA_DEVICE_SM_LIMIT_ indicates the sm utility percentage of each device

```bash
# Add 1GiB memory limit and set max SM utility to 50% for all devices
export LD_PRELOAD=./libvgpu.so
export LD_PRELOAD=./build/libvgpu.so
export CUDA_DEVICE_MEMORY_LIMIT=1g
export CUDA_DEVICE_SM_LIMIT=50
```
Expand Down
4 changes: 2 additions & 2 deletions src/cuda/hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#include <string.h>
#include "include/libvgpu.h"
#include "include/multi_func_hook.h"

#include "include/hook.h"

typedef void* (*fp_dlsym)(void*, const char*);
extern fp_dlsym real_dlsym;

cuda_entry_t cuda_library_entry[] = {
entry_t cuda_library_entry[] = {
/* Init Part */
{.name = "cuInit"},
/* Deivce Part */
Expand Down
13 changes: 13 additions & 0 deletions src/include/hook.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef __HOOK_H__
#define __HOOK_H__

typedef struct {
void *fn_ptr; // function pointer
char *name; //function name
} entry_t;

#define OVERRIDE_ENUM(x) OVERRIDE_##x

#define FIND_ENTRY(table, sym) ({ (table)[OVERRIDE_ENUM(sym)].fn_ptr; })

#endif // __HOOK_H__
Loading