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
diff --git a/.ebextensions/https-redirect-docker-sc.config b/.ebextensions/https-redirect-docker-sc.config | |
index fa2fbdc..5ea1cae 100644 | |
--- a/.ebextensions/https-redirect-docker-sc.config | |
+++ b/.ebextensions/https-redirect-docker-sc.config | |
@@ -33,14 +33,14 @@ files: | |
default "upgrade"; | |
"" ""; | |
} | |
- | |
+ |
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
################################################################################################### | |
#### Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
#### | |
#### Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file | |
#### except in compliance with the License. A copy of the License is located at | |
#### | |
#### http://aws.amazon.com/apache2.0/ | |
#### | |
#### or in the "license" file accompanying this file. This file is distributed on an "AS IS" | |
#### BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
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
const int PIXEL_COUNT = 500 * 500; | |
auto pixelCounts = thrust::device_vector<unsigned int>(PIXEL_COUNT); | |
thrust::fill(pixelCounts.begin(), pixelCounts.end(), 0); |
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
const int PIXEL_COUNT = 500 * 500; | |
usigned int *pixelBodyCounts; | |
cudaMallocManaged(&pixelBodyCounts, PIXEL_COUNT * sizeof(unsigned int)); | |
initZeros<<<numBlocks, blockSize>>>(pixelBodyCounts); | |
// do stuff with the pixels | |
cudaFree(pixelBodyCounts); |
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
==24803== NVPROF is profiling process 24803, command: ./main-thrust | |
==24803== Profiling application: ./main-thrust | |
==24803== Profiling result: | |
Type Time(%) Time Calls Avg Min Max Name | |
GPU activities: 74.98% 157.91ms 2 78.954ms 77.478ms 80.430ms void thrust::cuda_cub::core::_kernel_agent<thrust::cuda_cub::__parallel_for::ParallelForAgent<thrust::cuda_cub::__transform::unary_transform_f<thrust::counting_iterator<unsigned int, thrust::use_default, thrust::use_default, thrust::use_default>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::cuda_cub::__transform::no_stencil_tag, initRandomPrg, thrust::cuda_cub::__transform::always_true_predicate>, long>, thrust::cuda_cub::__transform::unary_transform_f<thrust::counting_iterator<unsigned int, thrust::use_default, thrust::use_default, thrust::use_default>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::cuda_cub::__transform::no_stencil_tag, initRandomPrg, thrust::cuda_cub |
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
struct initRandomPrg { | |
float minValue, maxValue; | |
__host__ __device__ | |
initRandomPrg(float _mnV=0.f, float _mxV=1.f) : minValue(_mnV), maxValue(_mxV) {}; | |
__host__ __device__ | |
float operator()(const unsigned int n) const { | |
thrust::default_random_engine rng; | |
thrust::uniform_real_distribution<float> dist(minValue, maxValue); |
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
==21393== Profiling application: ./main-cuda.cuda | |
==21393== Profiling result: | |
Type Time(%) Time Calls Avg Min Max Name | |
GPU activities: 73.42% 227.76ms 2 113.88ms 113.37ms 114.40ms void initRandom<float>(float*, float, float) | |
26.58% 82.465ms 10 8.2465ms 4.8140ms 39.102ms void add<float>(float*, float*, float*) | |
API calls: 61.88% 310.24ms 11 28.204ms 4.8177ms 227.74ms cudaDeviceSynchronize | |
32.78% 164.31ms 3 54.771ms 49.680us 164.11ms cudaMallocManaged | |
4.87% 24.428ms 3 8.1428ms 8.1220ms 8.1685ms cudaFree | |
0.32% 1.6288ms 12 135.74us 19.770us 559.03us cudaLaunch | |
0.11% 528.26us 94 5.6190us 240ns 229.88us cuDeviceGetAttribute |
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
// add two arrays | |
template<typename T> | |
__global__ void add(T *output, T *inputA, T *inputB) { | |
int idx = (blockIdx.x * blockDim.x) + threadIdx.x; | |
output[idx] = inputA[idx] + inputB[idx]; | |
} | |
template<typename T> | |
__global__ void initRandom(T *arr, float minValue, float maxValue) { | |
int idx = blockIdx.x * blockDim.x + threadIdx.x; |
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
#include <iostream> | |
#include <math.h> | |
#include <cstdlib> | |
#include <vector> | |
int main () { | |
int N = 8000 * 8000; // 800px x 800px image | |
int iterations = 10; | |
int size = N*sizeof(float); | |
float *x, *y, *output; |
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
CC:=/usr/local/cuda-9.1/bin/nvcc | |
PROF:=/usr/local/cuda-9.1/bin/nvprof | |
run: main-cuda.cuda | |
./main-cuda.cuda | |
prof: main-cuda main-cpu main-thrust | |
${PROF} ./main-cuda | |
@echo | |
${PROF} ./main-thrust |
NewerOlder