diff --git a/README.md b/README.md index dd258af..b478ea7 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,47 @@ 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) +* Xuntong Liang + * [LinkedIn](https://www.linkedin.com/in/xuntong-liang-406429181/), [GitHub](https://github.com/PacosLelouch), [twitter](https://twitter.com/XTL90234545). +* Tested on: Windows 10, i7-10750H @ 2.60GHz 16GB, RTX 2070 Super with Max-Q 8192MB -### (TODO: Your README) +### Part 3.1: CUDA -Include screenshots, analysis, etc. (Remember, this is public, so don't put -anything here that you don't want to share with the world.) +CUDA running result: + +![CUDA Test](images/cuda.png) + + + +Analysis: + +![CUDA Analysis](images/cuda-analysis.png) + +This needs us to go to `Nsight` -> `Nsight Systems 2021.2.4` -> `Trace`. + +Then in `NVIDIA Nsight Systems 2021.2.4 `, `Select target for profiling` -> `Start`. Make sure to fill in the correct `Command line with arguments` and `Working directory` in `Target application`, and check `Collect CUDA trace` and `Collect OpenGL trace`. + + + +Debug with Nsight: + +![Debug with Nsight](images/cuda-debug.png) + +The `blockIdx` is (12, 0, 0) and the `threadIdx` is (8, 1, 0). The thread counts from the `Shader Info` are discontinuous, and the threads between these thread indices are shown in `Threads`. We need to calculate that which is (8, 1, 0). Since the `blockDim` is (16, 16, 1), threads represented by (x, 1, 0) should be in the third or fourth group of threads. Then we can count x = 8, and find the corresponding thread, which is the first thread of the fourth group of threads. + + + +### Part 3.2: WebGL + +Check WebGL support: + +![Check WebGL support](images/webgl2support.png) + + + +### Part 3.3: DXR + +DXR test, with color (0.2, 0.4, 0.8): + +![DXR Test](images/dxr.png) diff --git a/cuda-getting-started/src/main.cpp b/cuda-getting-started/src/main.cpp index 886fd4c..7dfd1b8 100644 --- a/cuda-getting-started/src/main.cpp +++ b/cuda-getting-started/src/main.cpp @@ -10,8 +10,8 @@ * C main function. */ int main(int argc, char* argv[]) { - // TODO: Change this line to use your name! - m_yourName = "TODO: YOUR NAME HERE"; + // DONE: Change this line to use your name! + m_yourName = "Xuntong Liang"; if (init(argc, argv)) { mainLoop(); diff --git a/dxr-support/src/D3D12RaytracingHelloWorld/D3D12RaytracingHelloWorld.cpp b/dxr-support/src/D3D12RaytracingHelloWorld/D3D12RaytracingHelloWorld.cpp index 9e78c8f..e1c9476 100644 --- a/dxr-support/src/D3D12RaytracingHelloWorld/D3D12RaytracingHelloWorld.cpp +++ b/dxr-support/src/D3D12RaytracingHelloWorld/D3D12RaytracingHelloWorld.cpp @@ -60,6 +60,9 @@ void D3D12RaytracingHelloWorld::EnableDirectXRaytracing(IDXGIAdapter1* adapter) void D3D12RaytracingHelloWorld::OnInit() { + // Modify my adapter ID to get NVIDIA GPU. + m_adapterIDoverride = 1; + m_deviceResources = std::make_unique( DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_UNKNOWN, diff --git a/dxr-support/src/D3D12RaytracingHelloWorld/Raytracing.hlsl b/dxr-support/src/D3D12RaytracingHelloWorld/Raytracing.hlsl index d817ca4..7de1987 100644 --- a/dxr-support/src/D3D12RaytracingHelloWorld/Raytracing.hlsl +++ b/dxr-support/src/D3D12RaytracingHelloWorld/Raytracing.hlsl @@ -69,7 +69,8 @@ void MyRaygenShader() [shader("closesthit")] void MyClosestHitShader(inout RayPayload payload, in MyAttributes attr) { - float3 barycentrics = float3(1 - attr.barycentrics.x - attr.barycentrics.y, attr.barycentrics.x, attr.barycentrics.y); + // float3 barycentrics = float3(1 - attr.barycentrics.x - attr.barycentrics.y, attr.barycentrics.x, attr.barycentrics.y); + float3 barycentrics = float3(0.2, 0.4, 0.8); payload.color = float4(barycentrics, 1); } diff --git a/images/cuda-analysis.png b/images/cuda-analysis.png new file mode 100644 index 0000000..c93e9fd Binary files /dev/null and b/images/cuda-analysis.png differ diff --git a/images/cuda-debug.png b/images/cuda-debug.png new file mode 100644 index 0000000..73059e7 Binary files /dev/null and b/images/cuda-debug.png differ diff --git a/images/cuda.png b/images/cuda.png new file mode 100644 index 0000000..8f66027 Binary files /dev/null and b/images/cuda.png differ diff --git a/images/dxr.png b/images/dxr.png new file mode 100644 index 0000000..2cbb990 Binary files /dev/null and b/images/dxr.png differ diff --git a/images/webgl2support.png b/images/webgl2support.png new file mode 100644 index 0000000..b0937e5 Binary files /dev/null and b/images/webgl2support.png differ