aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile13
-rw-r--r--README.md56
2 files changed, 62 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index dcf44e4..0e9ee3a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
1CC = gcc 1CC = gcc
2CXX = g++
2NVCC ?= nvcc 3NVCC ?= nvcc
3# -fPIC is needed in all cases, as we may be linked into another shared library 4# -fPIC is needed in all cases, as we may be linked into another shared library
4CFLAGS = -fPIC 5CFLAGS = -fPIC
@@ -18,22 +19,22 @@ libsmctrl_test_gpc_info: libsmctrl_test_gpc_info.c libsmctrl.a testbench.h
18 $(CC) $< -o $@ -g -L. -l:libsmctrl.a $(LDFLAGS) 19 $(CC) $< -o $@ -g -L. -l:libsmctrl.a $(LDFLAGS)
19 20
20libsmctrl_test_mask_shared.o: libsmctrl_test_mask_shared.cu testbench.h 21libsmctrl_test_mask_shared.o: libsmctrl_test_mask_shared.cu testbench.h
21 $(NVCC) $< -c -g 22 $(NVCC) -ccbin $(CXX) $< -c -g
22 23
23libsmctrl_test_global_mask: libsmctrl_test_global_mask.c libsmctrl.a libsmctrl_test_mask_shared.o 24libsmctrl_test_global_mask: libsmctrl_test_global_mask.c libsmctrl.a libsmctrl_test_mask_shared.o
24 $(NVCC) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS) 25 $(NVCC) -ccbin $(CXX) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS)
25 26
26libsmctrl_test_stream_mask: libsmctrl_test_stream_mask.c libsmctrl.a libsmctrl_test_mask_shared.o 27libsmctrl_test_stream_mask: libsmctrl_test_stream_mask.c libsmctrl.a libsmctrl_test_mask_shared.o
27 $(NVCC) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS) 28 $(NVCC) -ccbin $(CXX) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS)
28 29
29libsmctrl_test_stream_mask_override: libsmctrl_test_stream_mask_override.c libsmctrl.a libsmctrl_test_mask_shared.o 30libsmctrl_test_stream_mask_override: libsmctrl_test_stream_mask_override.c libsmctrl.a libsmctrl_test_mask_shared.o
30 $(NVCC) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS) 31 $(NVCC) -ccbin $(CXX) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS)
31 32
32libsmctrl_test_next_mask: libsmctrl_test_next_mask.c libsmctrl.a libsmctrl_test_mask_shared.o 33libsmctrl_test_next_mask: libsmctrl_test_next_mask.c libsmctrl.a libsmctrl_test_mask_shared.o
33 $(NVCC) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS) 34 $(NVCC) -ccbin $(CXX) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS)
34 35
35libsmctrl_test_next_mask_override: libsmctrl_test_next_mask_override.c libsmctrl.a libsmctrl_test_mask_shared.o 36libsmctrl_test_next_mask_override: libsmctrl_test_next_mask_override.c libsmctrl.a libsmctrl_test_mask_shared.o
36 $(NVCC) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS) 37 $(NVCC) -ccbin $(CXX) $@.c -o $@ libsmctrl_test_mask_shared.o -g -L. -l:libsmctrl.a $(LDFLAGS)
37 38
38tests: libsmctrl_test_gpc_info libsmctrl_test_global_mask libsmctrl_test_stream_mask libsmctrl_test_stream_mask_override libsmctrl_test_next_mask libsmctrl_test_next_mask_override 39tests: libsmctrl_test_gpc_info libsmctrl_test_global_mask libsmctrl_test_stream_mask libsmctrl_test_stream_mask_override libsmctrl_test_next_mask libsmctrl_test_next_mask_override
39 40
diff --git a/README.md b/README.md
index 6e7c75d..3689ecd 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,52 @@ Please cite this paper in any work which leverages our library. Here's the BibTe
20Please see [the paper](https://www.cs.unc.edu/~jbakita/rtas23.pdf) and libsmctrl.h for details and examples of how to use this library. 20Please see [the paper](https://www.cs.unc.edu/~jbakita/rtas23.pdf) and libsmctrl.h for details and examples of how to use this library.
21We strongly encourage consulting those resources first; the below comments serve merely as an appendum. 21We strongly encourage consulting those resources first; the below comments serve merely as an appendum.
22 22
23## Run-time Dependencies
24`libcuda.so`, which is automatically installed by the NVIDIA GPU driver.
25
26## Building
27To build, ensure that you have `gcc` installed and access to the CUDA SDK including `nvcc`. Then run:
28```
29make libsmctrl.a
30```
31
32If you see an error that the command `nvcc` was not found, `nvcc` is not available on your `PATH`.
33Correct this error by explictly specifying the location of `nvcc` to `make`, e.g.:
34```
35make NVCC=/playpen/jbakita/CUDA/cuda-archive/cuda-10.2/bin/nvcc libsmctrl.a
36```
37
38For binary backwards-compatibility to old versions of the NVIDIA GPU driver, we recommend building with an old version of the CUDA SDK.
39For example, by building against CUDA 10.2, the binary will be compatible with any version of the NVIDIA GPU driver newer than 440.36 (Nov 2019), but by building against CUDA 8.0, the binary will be compatible with any version of the NVIDIA GPU driver newer that 375.26 (Dec 2016).
40
41Older versions of `nvcc` may require you to use an older version of `g++`.
42This can be explictly specified via the `CXX` variable, e.g.:
43```
44make NVCC=/playpen/jbakita/CUDA/cuda-archive/cuda-8.0/bin/nvcc CXX=g++-5 libsmctrl.a
45```
46
47`libsmctrl` supports being built as a shared library.
48This will require you to distribute `libsmctrl.so` with your compiled program.
49If you do not know what a shared library is, or why you would need to specify the path to `libsmctrl.so` in `LD_LIBRARY_PATH`, do not do this.
50To build as a shared library, replace `libsmctrl.a` with `libsmctrl.so` in the above commands.
51
52## Linking in Your Application
53If you have cloned and built `libsmctrl` in the folder `/playpen/libsmctrl` (replace this with the location you use):
54
551. Add `-I/playpen/libsmctrl` to your compiler command (this allows `#include <libsmctrl.h>` in your C/C++ files).
562. Add `-lsmctrl` to your linker command (this allows the linker to resolve the `libsmctrl` functions you use to the implementations in `libsmctrl.a` or `libsmctrl.so`).
573. Add `-L/playpen/libsmctrl` to your linker command (this allows the linker to find `libsmctrl.a` or `libsmctrl.so`).
584. (If not already included) add `-lcuda` to your linker command (this links against the CUDA driver library).
59
60Note that if you have compiled both `libsmctrl.a` (the static library) and `libsmctrl.so` (the shared library), most compilers will prefer the shared library.
61To statically link against `libsmctrl.a`, delete `libsmctrl.so`.
62
63For example, if you have a CUDA program written in `benchmark.cu` and have built `libsmctrl`, you can compile and link against `libsmctrl` via the following command:
64```
65nvcc benchmark.cu -o benchmark -I/playpen/libsmctl -lsmctrl -lcuda -L/playpen/libsmctrl
66```
67The resultant `benchmark` binary should be portable to any system with an equivalent or newer version of the NVIDIA GPU driver installed.
68
23## Run Tests 69## Run Tests
24To test partitioning: 70To test partitioning:
25``` 71```
@@ -29,9 +75,17 @@ make tests
29./libsmctrl_test_next_mask 75./libsmctrl_test_next_mask
30``` 76```
31 77
78To test that high-granularity masks override low-granularity ones:
79```
80make tests
81./libsmctrl_test_stream_mask_override
82./libsmctrl_test_next_mask_override
83```
84
32And if `nvdebug` has been installed: 85And if `nvdebug` has been installed:
33``` 86```
34./libsmctrl_test_gpu_info 87make tests
88./libsmctrl_test_gpc_info
35``` 89```
36 90
37## Supported GPUs 91## Supported GPUs