forked from shinpei0208/gdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
161 lines (129 loc) · 5.04 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#
# Gdev - Managing GPUs as First-Class Computing Resources
#
# README
#
# Copyright (C) Shinpei Kato
# University of California, Santa Cruz
# Systems Research Lab.
# In collaboration with PathScale Inc.
#
# All Rights Reserved.
#
Gdev is a runtime-unified operating system module that manages GPUs
as first-class computing resources.
Currently it supports only NVIDIA's Fermi GPUs, but the concept of
Gdev is also applicable to generic "compute devices".
Gdev coordinates with a DRM-based GPU device driver (pscnv/nouveau)
in the operating system, providing APIs for application programs.
Gdev API is a low-level primitive that allows programmers to control
the details of GPU resource parameters, while Gdev also supports a
high-level API, such as CUDA.
Gdev is available for GPGPU and graphics applications. It is self-
contained for GPGPU, though graphics applications require additional
packages, such as OpenGL, LIBDRM, and DDX.
Gdev is open-source. We believe that this open-source implementation
facilitates further research and development of GPU technology.
The following instruction will tell you how to install Gdev. Some of
the installation stages may require you to install additional tools
and packages.
$(TOPDIR) will represent your top working directory, henceforth.
1. Download
cd $(TOPDIR)
git clone git://0x04.net/envytools.git
git clone git://github.com/shinpei0208/gdev.git
2. envytools
envytools is a rich set of open-source tools to compile or decompile
NVIDIA GPU program code, firmware code, macro code, and so on. It is
also used to generate C header files with GPU command definitions.
In addition, envytools document the NVIDIA GPU architecture details,
while are not disclosed to the public so far. If you are interested
in GPU system software development, this is what you should read!
Please follow the instruction below to install envytools.
cd $(TOPDIR)/envytools
mkdir build
cd build
cmake .. # may require some packages on your distro
make
sudo make install # will install tools to /usr/local/{bin,lib}
3. Device Driver
Recent versions of Gdev disgregate from the device driver. You need
to install some GPU device driver underlying Gdev. Currently there
are two open-source drivers available in Linux: pscnv and nouveau.
The following shows how to install pscnv.
NOTE1: pscnv is PathScale's open-source driver, but we have applied
several patches, making it available for Gdev.
NOTE2: pscnv is available with Linux 2.6.33 or later. It may also
have issues with some Fermi chipsets - nvc0 is best tested.
See http://nouveau.freedesktop.org/wiki/CodeNames for chipset IDs.
3.1. When you use pscnv
cd $(TOPDIR)/gdev/driver/pscnv
./configure
make
sudo make modules_install
sudo shutdown -r now # will reboot your machine
3.2. When you use nouveau
cd $(TOPDIR)/gdev/driver/nouveau
make NOUVEAUROOTDIR=.
sudo make install NOUVEAUROOTDIR=.
cd drivers/gpu/drm/nouveau
sudo sh gdev.sh
sudo shutdown -r now # will reboot your machine
If you are not sure if Nouveau is loaded successfully, do:
modprobe -r nouveau; modprobe nouveau modeset=1 noaccel=0
4. Gdev Module
Gdev is double-edge, i.e., it provides a runtime-unified operating
system approach as well as a typical user-space runtime approach.
The following installation is required only for the former.
cd $(TOPDIR)/gdev/driver
mkdir build
cd build
../configure
make
sudo insmod gdev.ko
sudo sh gdev.sh
5. Gdev Library
Gdev's user-space library provides Gdev API. This API can be used
by either user programs directly or another high-level API library.
For instance, third party's CUDA library can use Gdev API.
If you have taken Step 4, i.e., chosen the runtime-unified operating
system approach, this library is just a set of wrapper functions
that call Gdev module's functions via ioctl.
cd $(TOPDIR)/gdev/lib
mkdir build
cd build
../configure # if you skipped Step 4, you must specify --target=user
make
sudo make install
export LD_LIBRARY_PATH="/usr/local/gdev/lib64:$LD_LIBRARY_PATH"
export PATH="/usr/local/gdev/bin:$PATH"
6. CUDA Driver API
Gdev currently supports a limited set of CUDA Driver API. We plan to
support a full set of CUDA Driver API in future work. If you need
CUDA Runtime API, you should use some compiler framework, such as
Ocelot, which can translate CUDA Drier API to Runtime API.
cd $(TOPDIR)/gdev/cuda
mkdir build
cd build
../configure
make
sudo make install
Gdev also supports CUDA in the operating system. You are required to
install "kcuda" module to use this functionality.
cd $(TOPDIR)/gdev/cuda
mkdir kbuild
../configure --target=kcuda
make
sudo make install
7. CUDA Driver API test (user-space programs)
cd $(TOPDIR)/test/cuda/user/madd
make
./user_test 256 # a[256] x b[256] = c[256]
8. CUDA Driver API test (OS-space programs)
cd $(TOPDIR)/test/cuda/kernel/memcpy
make
sudo insmod ./kernel_test.ko size=10000 # copy 0x10000 size
NOTE: Please be careful when doing this test as it runs a program
in module_init(). If you run a very long program as it is, you may
crash your system. If you want to run a very long program, you must
provide a proper module implementation, e.g., using kernel threads.