Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d9e6ca
commit 8087bb3
Showing
32 changed files
with
407 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
# Pointer to int typecasts | ||
Implementation defined. | ||
http://stackoverflow.com/questions/7677919/unexpected-sign-extension-of-int32-or-32bit-pointer-when-converted-to-uint64 | ||
TODO convert forward and back guaranteed equal? | ||
*/ | ||
|
||
#include "common.h" | ||
|
||
int main() { | ||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
# Placement new | ||
TODO | ||
http://stackoverflow.com/questions/222557/what-uses-are-there-for-placement-new | ||
*/ | ||
|
||
#include "common.hpp" | ||
|
||
int main() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../Makefile_many |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.POSIX: | ||
|
||
.PHONY: all clean | ||
|
||
all: | ||
gcc -std=c89 -o main.out main.c -lOpenCL | ||
|
||
clean: | ||
rm hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
LIBS := -lm -pthread -lOpenCL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
# OpenCL | ||
|
||
OpenCL is an open standard language which models CPU GPU computing. | ||
|
||
It is similar to C, containing some extra keywords to model the CPU GPU world, and leaving out a few C features which GPUs cannot yet do very well. | ||
|
||
As of 2013 its major concurrent is CUDA, which NVIDIA proprietary. Current NVIDIA do support both CUDA and OpenCL. | ||
|
||
The OpenCL standard in maintained by the Khronos Group, the same guys who maintain OpenGL. They are an industry consortium. | ||
|
||
OpenCL, like any other language has versions. As of 2013 the latest version is OpenCL 2.0 released in preview (unstable) as of Jul 2013. | ||
|
||
## Install | ||
|
||
The first step is to get you GPU working. Good luck on that, specially if you are on Linux =) | ||
|
||
Next, you will need an SDK developed by the GPU vendor. There is no fixed standard assembly language for GPUs, in part because GPUs are changing very fast, so vendors do not want to get tied down to an interface. Therefore, the only way to go is to pass through the vendor SDK which should implement OpenCL. | ||
1. [Getting started](getting-started.md) | ||
1. Examples | ||
1. [min](min.c) | ||
1. [hello_world](hello_world.c) | ||
1. Theory | ||
1. [Introduction](introduction.md) | ||
1. [Concepts](concepts.md) | ||
1. [clinfo](clinfo.md) | ||
1. [Bibliography](bibliography.md) | ||
1. [TODO](TODO.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# TODO | ||
|
||
1. Compare speeds of `CL_DEVICE_TYPE_GPU` and `CL_DEVICE_TYPE_CPU`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Bibliography | ||
|
||
- Khronos standards: <https://www.khronos.org/registry/cl/> | ||
- <http://developer.amd.com/tools-and-sdks/opencl-zone/opencl-resources/> | ||
- <http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook> | ||
- The specifications of your hardware, e.g. <http://www.nvidia.com/object/nvs_techspecs.html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# clinfo | ||
|
||
`glxinfo` for OpenCL: | ||
|
||
sudo clinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Concepts | ||
|
||
## Platform | ||
|
||
TODO what is a platform? | ||
|
||
<http://stackoverflow.com/questions/3444664/does-any-opencl-host-have-more-than-one-platform> | ||
|
||
## Compute unit | ||
|
||
TODO vs core? Each compute unit has a number of cores it seems: | ||
|
||
## Work group | ||
|
||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Getting started | ||
|
||
## NVIDIA | ||
|
||
On Ubuntu 15.10 with an NVIDIA NVS 5400M, Lenovo T430: | ||
|
||
sudo apt-get install nvidia-352 nvidia-352-dev nvidia-prime | ||
sudo ln -s /usr/include/nvidia-352/GL /usr/local/include | ||
sudo ln -s /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 /usr/local/lib/libOpenCL.so | ||
|
||
Then compile with: | ||
|
||
gcc -o main main.c -lOpenCL | ||
|
||
Notes: | ||
|
||
- find your GPU model: <http://askubuntu.com/questions/72766/how-do-i-find-out-the-model-of-my-graphics-card> | ||
- test that the driver is working: <http://askubuntu.com/questions/68028/how-do-i-check-if-ubuntu-is-using-my-nvidia-graphics-card> | ||
- do not install the `nvidia-current` package. It is old. Either `apt-cache search nvidia` and get the latest one, or use `software-properties-gtk` "Additional Drivers" tab. |
Oops, something went wrong.