Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emily Vo #43

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
18 changes: 15 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.1)

project(cis565_getting_started)

# IMPORTANT: Set this to the correct path to cl.exe. It should be under the MSVStudio 2017 installation directory
# e.g: "D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe"
set(CL_PATH "D:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe")

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

# Set up include and lib paths
Expand All @@ -12,7 +16,15 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/linux" "/usr/lib64")
elseif(WIN32)
if(${MSVC_VERSION} MATCHES "1900")
if(${MSVC_VERSION} MATCHES "1916")
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/win/vc2017")

if ("${CL_PATH}" MATCHES "NULL")
MESSAGE("Error: please set CL_PATH to a correct path to cl.exe. Edit this in CMakeLists.txt under the project root.")
endif()

set(CUDA_HOST_COMPILER "${CL_PATH}")
elseif(${MSVC_VERSION} MATCHES "1900")
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/win/vc2015")
elseif(${MSVC_VERSION} MATCHES "1800")
set(EXTERNAL_LIB_PATH "${EXTERNAL}/lib/win/vc2013")
Expand Down Expand Up @@ -66,7 +78,7 @@ endif()

# Crucial magic for CUDA linking
find_package(Threads REQUIRED)
find_package(CUDA 8.0 REQUIRED)
find_package(CUDA 10.0 REQUIRED)

set(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE ON)
set(CUDA_SEPARABLE_COMPILATION ON)
Expand Down
138 changes: 101 additions & 37 deletions INSTRUCTION.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,66 @@
Project 0 CUDA Getting Started: Instructions
Project 0 Getting Started: Instructions
========================

This is due **Friday, September 1 2017**. (See [late policy](#late-policy) at the bottom)
This is due ** TODO NEW DEADLINE**. (See [late policy](#late-policy) at the bottom)

**Summary:** In this project, you will set up your CUDA development tools and
**Summary:** In this project, you will set up your GPU development tools and
verify that you can build, run, and do performance analysis.

This project is a simple program that demonstrates CUDA and OpenGL functionality
Among other things, this project will give the TAs a sense of what projects students can or cannot run (e.g. WebGL, DirectX Realtime Raytracing).
Make sure to fill out the survey at the end of this readme so the TAs can collect statistics.

This project contains:
1. A simple program that demonstrates CUDA and OpenGL functionality
and interoperability, testing that CUDA has been properly installed. If the
machine you are working on has CUDA and OpenGL 4.0 support, then when you run
the program, you should see either one or two colors depending on your
graphics card.
2. A guide to enable WebGL support on your machine.
3. A simple project to test your machine's (in)ability to run DXR for realtime raytracing projects.

This project (and all other CUDA projects in this course) requires an NVIDIA
graphics card with CUDA capability. Any card with Compute Capability 2.0
(`sm_20`) or greater will work. Gheck your GPU in this [compatibility
table](https://developer.nvidia.com/cuda-gpus). If you do not have a personal
machine with these specs, you may use computers in the Moore or SIG Labs.
**Even if you need to use the lab computer for your development, follow these steps:**

**If you need to use the lab computer for your development:**
## Part 0: Sign up to CIS 565 on Piazza and fill out the form

CUDA 8.0, Visual Studio 2015, CMake and Git are already installed on all of the CETS Lab PCs including the machines in Moore 100B and Moore 100C.
- Sign up [here](http://piazza.com/upenn/fall2019/cis565) to our piazza class - we will be using Piazza for questions / updates. We encourage student questions and responses on this, meaning the TAs will wait a bit before responding to posts to promote student engagement.
- Fill out the form in the [@6](https://piazza.com/class/jz8re68445r142?cid=6) post.

## Part 1: Setting up your development environment

Skip this part if you are developing on a lab computer.
#### Notes

- Before you get started: if you have multiple VS and/or CMake versions, you will probably run into trouble. Either uninstall extra versions (if possible) or ensure that the correct VS (or XCode) and CMake versions are being chosen.
- If you are running into a lot of trouble, a clean installation of VS (or XCode), CMake, and CUDA can help fix any problems if other methods don't work.
- If you have driver issues or random crashing: uninstalling and reinstalling drivers usually works

## Part 1.0: Integrated Development Environment

### Windows

1. Make sure you are running Windows 7/8/10 and that your NVIDIA drivers are
up-to-date. You will need support for OpenGL 4.0 or better in this course.
2. Install Visual Studio 2015.
* 2012/2013 will also work, if you already have one installed.
* 2010 doesn't work because glfw only supports 32-bit binaries for vc2010.
up-to-date (a reboot is usually required for driver installations to work). You will need support for OpenGL 4.0 or better in this course.
2. Install Visual Studio 2017.
**We don't provide libraries for Win32**
* http://www.seas.upenn.edu/cets/software/msdn/
* You need C++ support. None of the optional components are necessary.
3. Install [CUDA 8](https://developer.nvidia.com/cuda-downloads).
* CUDA 8 is enforced for consistency because VS2015 doesn't support CUDA 7.5.
However, if you have any reason that you have to use CUDA 7.5, please clarify
you're using CUDA 7.5 in your report. Also you need to change `find_package(CUDA 8.0 REQUIRED)` in `CMakeLists.txt` to `find_package(CUDA REQUIRED)` before you build your project.

* Follow http://www.seas.upenn.edu/cets/software/msdn/
* Once you're in the Microsoft Azure download page, look for `Visual Studio 2017 Community` and download it.
* Make sure this ends up installing the `Visual Studio Installer` so you can select the packages you want.
* Once in the installer, do the following:
* Under the `Workloads` tab, select `Desktop Development with C++`. This will select almost everything you will need.
* Under the `Individual Components Tab`, make sure these packages are selected. DO NOT uncheck everything else.
* `VC++ 2017 version 15.9 v14.16 latest v141 tools`
* `Visual Studio C++ core features`
* `C++ Profiling Tools`
* `C++/CLI support`
* `Visual C++ ATL for x86 and x64`
* `Windows 10 SDK 10.0.17763.0`
* `NuGet Package Manager`
* `MSBuild`

3. Install [CUDA 10](https://developer.nvidia.com/cuda-downloads).
* Use the Express installation. If using Custom, make sure you select Nsight for Visual Studio.
4. Install [CMake](http://www.cmake.org/download/). (Windows binaries are
4. Install [Git](https://git-scm.com/download/win).
5. Install [CMake](http://www.cmake.org/download/). (Windows binaries are
under "Binary distributions.")
5. Install [Git](https://git-scm.com/download/win).

### OS X

Expand All @@ -53,11 +69,8 @@ Skip this part if you are developing on a lab computer.
* On 10.10, this may not actually be necessary. Try running `gcc`
in a terminal first.
3. Install OS X Unix Command Line Development Tools (if necessary).
4. Install [CUDA 8](https://developer.nvidia.com/cuda-downloads)
4. Install [CUDA 10](https://developer.nvidia.com/cuda-downloads)
(don't use cask; the CUDA cask is outdated).
* CUDA 8 is recommended.
However, if you have any reason that you have to use CUDA 7.5, please clarify
you're using CUDA 7.5 in your report. Also you need to change `find_package(CUDA 8.0 REQUIRED)` in `CMakeLists.txt` to `find_package(CUDA REQUIRED)` before you build your project.
* Make sure you select Nsight.
5. Install [Git](https://git-scm.com/download/mac)
(or: `brew install git`).
Expand All @@ -69,15 +82,65 @@ Skip this part if you are developing on a lab computer.
Note: to debug CUDA on Linux, you will need an NVIDIA GPU with Compute
Capability 5.0.

1. Install [CUDA 8](https://developer.nvidia.com/cuda-downloads).
* CUDA 8 is recommended.
However, if you have any reason that you have to use CUDA 7.5, please clarify
you're using CUDA 7.5 in your report. Also you need to change `find_package(CUDA 8.0 REQUIRED)` in `CMakeLists.txt` to `find_package(CUDA REQUIRED)` before you build your project.
For more Linux installation info, check out [CUDA_Linux Installation Guide](http://developer2.download.nvidia.com/compute/cuda/8.0/secure/Prod2/docs/sidebar/CUDA_Installation_Guide_Linux.pdf?weyH9mwDHKcyP4LBe1idPT47TTMqM6s3HKNrW1hOYPlw0om73Jx7isV6gG6L3O7p6pJm1JNcY4sp_4LDlBVE7dG7mGyjDeKq5O_T7eRdBDlb1I-ZhvperJ5VfM8dT_R6RuRj5hTUEijr5vY8_KFfZAQ1dvq2CQOW5O2gLBtMc3UISE-o11fzsUTBYQ).
1. Install [CUDA 10](https://developer.nvidia.com/cuda-downloads).
* Make sure you select Nsight.
2. Install Git (`apt-get install git` on Debian/Ubuntu).
3. Install CMake (`apt-get install cmake` on Debian/Ubuntu).

## Part 1.1: CUDA

All CUDA projects in this course require an NVIDIA
graphics card with CUDA capability. Any card with Compute Capability 2.0
(`sm_20`) or greater will work. Gheck your GPU in this [compatibility
table](https://developer.nvidia.com/cuda-gpus). If you do not have a personal
machine with these specs, you may use computers in the Moore or SIG Labs.

### Windows

1. Install [CUDA 10](https://developer.nvidia.com/cuda-downloads).
* Use the Express installation. If using Custom, make sure you select Nsight for Visual Studio.

### OS X

1. Install [CUDA 10](https://developer.nvidia.com/cuda-downloads)
(don't use cask; the CUDA cask is outdated).
* Make sure you select Nsight.

### Linux

Note: to debug CUDA on Linux, you will need an NVIDIA GPU with Compute
Capability 5.0.

1. Install [CUDA 10](https://developer.nvidia.com/cuda-downloads).
* Make sure you select Nsight.

## Part 1.2: WebGL

1. Download [Google Chrome](https://www.google.com/chrome/)
2. Check that you have [WebGL support](https://webglreport.com)
3. If step 2 doesn't show WebGL compatibility, then try the following:
* *Enabling WebGL*
* Go to `chrome://settings` (in the address bar)
* Click the `Advanced ▼` button at the bottom of the page
* In the `System` section, ensure the `Use hardware acceleration when available` checkbox is checked (you'll need to relaunch Chrome for any changes to take effect)
* Go to `chrome://flags`
* Ensure that `Disable WebGL` is not activated (you'll need to relaunch Chrome for any changes to take effect)
* In newer versions, this option of `Disable WebGL` will not be available, you will instead have to search for `WebGL 2.0` (or some different version)
* If an option appears as `Default`, changed it to `Enabled`
* You should also change `Override software rendering list` to `Enabled`
* *Checking WebGL status*
* Go to `chrome://gpu`
* Inspect the WebGL item in the Graphics Feature Status list. The status will be one of the following:
* Hardware accelerated — WebGL is *enabled* and hardware-accelerated (running on the graphics card).
* Software only, hardware acceleration unavailable — WebGL is *enabled*, but running in software.
* Unavailable — WebGL is *not available* in hardware or software.

## Part 1.3: DXR

This part will *only* work if you are using a Windows 10 computer. Skip this if you are not using Windows 10.

1. Follow this [GitHub link](https://github.com/CIS565-Fall-2018/Project0-DXR-Support) once you're done with all parts in this readme.

## Part 2: Fork & Clone

1. Use GitHub to fork this repository into your own GitHub account.
Expand All @@ -98,7 +161,6 @@ Capability 5.0.
* [How to use GitHub](https://guides.github.com/activities/hello-world/)
* [How to use Git](http://git-scm.com/docs/gittutorial)


## Part 3: Build & Run

* `src/` contains the source code.
Expand All @@ -120,7 +182,7 @@ just rebuild your VS/Nsight project to make it update itself.
* `cmake-gui ..` or `"C:\Program Files (x86)\cmake\bin\cmake-gui.exe" ..`
* Don't forget the `..` part!
* Make sure that the "Source" directory is like
`.../Project0-CUDA-Getting-Started`.
`.../Project0-Getting-Started`.
* Click *Configure*. Select your version of Visual Studio, Win64.
(**NOTE:** you must use Win64, as we don't provide libraries for Win32.)
* If you see an error like `CUDA_SDK_ROOT_DIR-NOTFOUND`,
Expand All @@ -140,7 +202,7 @@ just rebuild your VS/Nsight project to make it update itself.

### OS X & Linux

It is recommended that you use Nsight. Nsight is shipped with CUDA. If you set up the environment path correctly `export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}` (Note that simply typing the `export` command is a temporary change. The `PATH` variable won't be updated permanently. For permanent change, add it to your shell configuration file, e.g. `~/.profile` on Ubuntu), you can run Nsight by typing `nsight` in your terminal.
It is recommended that you use Nsight. Nsight is shipped with CUDA. If you set up the environment path correctly `export PATH=/usr/local/cuda-10.0/bin${PATH:+:${PATH}}` (Note that simply typing the `export` command is a temporary change. The `PATH` variable won't be updated permanently. For permanent change, add it to your shell configuration file, e.g. `~/.profile` on Ubuntu), you can run Nsight by typing `nsight` in your terminal.

1. Open Nsight. Set the workspace to the one *containing* your cloned repo.
2. *File->Import...->General->Existing Projects Into Workspace*.
Expand Down Expand Up @@ -258,6 +320,8 @@ The template of the comment section of your pull request is attached below, you
* Feature 1
* ...
* Feedback on the project itself, if any.
* Do not forget to check for DXR compatibility. See section 1.3 above.
* Fill out this *mandatory* [survey](TODO SURVEY LINK HERE).

And you're done!

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Project 0 CUDA Getting Started
Project 0 Getting Started
====================

**University of Pennsylvania, CIS 565: GPU Programming and Architecture, Project 0**

* (TODO) YOUR NAME HERE
* (TODO) [LinkedIn](), [personal website](), [twitter](), etc.
* Tested on: (TODO) Windows 22, i7-2222 @ 2.22GHz 22GB, GTX 222 222MB (Moore 2222 Lab)

### (TODO: Your README)
Expand Down
Loading