c++-amp

Concurrency and memory models

陌路散爱 提交于 2019-12-13 11:41:17
问题 I'm watching this video by Herb Sutter on GPGPU and the new C++ AMP library. He is talking about memory models and mentions Weak Memory Models and then Strong Memory Models and I think he's referring to read/write ordering etc, but I am however not sure. Google turns up some interesting results (mostly science papers) on memory models, but can someone explain what is a Weak Memory Model and what is a Strong Memory Model and their relation to concurrency? 回答1: In terms of concurrency, a memory

C++ amp: Transferring data async and keeping data on accelerator

断了今生、忘了曾经 提交于 2019-12-12 10:13:01
问题 I have a often called function that is highly suited for parallel processing, so i investigated C++ amp for starters. The function accepts three inputs: a vector of floats, which is the input data a vector of constant coefficients, which stays the same throughout calls an output vector, where the result is written to. Now obviously, #1 has to be copied onto the GPU each call. For this, I'm using a stack-managed const array<>, which works fine. For #2, the optimal case would be to somehow keep

'Concurrency': a namespace with this name does not exist

*爱你&永不变心* 提交于 2019-12-11 18:06:48
问题 I am an amateur C# programmer who strayed into C++ because of a need for the C++ AMP technology for some heavy-duty number crunching. Hence, my C++ programming skills are not very well developed. For my first attempt at an actual program, I chose code based on a Daniel Moth's April 2012 article. I cannot get it to build. I always get the error: C2871 ‘Concurrency’: a namespace with this name does not exist. I know that the code was first written for Visual Studio 11, but I only had VS 2008

Several arithmetic operations parallelized in C++Amp

亡梦爱人 提交于 2019-12-11 08:58:49
问题 I am trying to parallelize a convolution filter using C++Amp. I would like the following function to start working (I don't know how to do it properly): float* pixel_color[] = new float [16]; concurrency::array_view<float, 2> pixels(4, 4, pixel_array), taps(4, 4, myTap4Kernel_array); concurrency::array_view<float, 1> pixel(16, pixel_color); // I don't know which data structure to use here parallel_for_each( pixels.extent, [=](concurrency::index<2> idx) restrict(amp) { int row=idx[0]; int col

Using pointers in C++Amp

心不动则不痛 提交于 2019-12-11 08:49:02
问题 I've got a following issue: I have a code which does a very basic operation. I am passing a pointer to a concurrency::array_view because I wanted to store the values earlier to avoid the bottle-neck in the function which uses multithreading. The problem is the following construction won't compile: parallel_for_each((*pixels).extent, [=](concurrency::index<2> idx) restrict(amp) { int row=idx[0]; int col=idx[1]; (*pixels)(row, col) = (*pixels)(row, col) * (*taps)(row, col); //this is the

Copy data from GPU to CPU

牧云@^-^@ 提交于 2019-12-05 18:53:33
I am trying to calculate a matrix using C++ AMP. I use an array with width and height of 3000 x 3000 and I repeat the calculating procedure 20000 times: //_height=_width=3000 extent<2> ext(_height,_width); array<int, 2> GPU_main(ext,gpuDevice.default_view); array<int, 2> GPU_res(ext,gpuDevice.default_view); copy(_main, GPU_main); array_view<int,2> main(GPU_main); array_view<int,2> res(GPU_res); res.discard_data(); number=20000; for(int i=0;i<number;i++) { parallel_for_each(e,[=](index<2> idx)restrict(amp) { res(idx)=main(idx)+idx[0];//not depend from calculation type } array_view<TYPE, 2> temp

Concurrency and memory models

萝らか妹 提交于 2019-12-03 12:44:49
I'm watching this video by Herb Sutter on GPGPU and the new C++ AMP library. He is talking about memory models and mentions Weak Memory Models and then Strong Memory Models and I think he's referring to read/write ordering etc, but I am however not sure. Google turns up some interesting results (mostly science papers) on memory models, but can someone explain what is a Weak Memory Model and what is a Strong Memory Model and their relation to concurrency? In terms of concurrency, a memory model specifies the constraints on data accesses, and the conditions under which data written by one thread

What is the current status of C++ AMP [closed]

风流意气都作罢 提交于 2019-12-02 17:58:21
I am working on high performance code in C++ and have been using both CUDA and OpenCL and more recently C++AMP, which I like very much. I am however a little worried that it is not being developed and extended and will die out. What leads me to this thought is that even the MS C++AMP blogs have been silent for about a year. Looking at the C++ AMP algorithms library http://ampalgorithms.codeplex.com/wikipage/history it seems nothing at all has happened for over a year. The only development I have seen is that now LLVM sort of supports C++AMP, so it is not windows only, but that is all, and not

will array_view.synchronize_asynch wait for parallel_for_each completion?

邮差的信 提交于 2019-12-02 04:18:11
If I have a concurrency::array_view being operated on in a concurrency::parallel_for_each loop, my understanding is that I can continue other tasks on the CPU while the loop is executing: using namespace Concurrency; array_view<int> av; parallel_for_each(extent<1>(number),[=](index<1> idx) { // do some intense computations on av } // do some stuff on the CPU while we wait av.synchronize(); // wait for the parallel_for_each loop to finish and copy the data But what if I want to not wait for the parallel for loop but start copying data back from the GPU as soon as possible . Will the following

C++AMP Computing gradient using texture on a 16 bit image

一曲冷凌霜 提交于 2019-12-02 03:31:33
I am working with depth images retrieved from kinect which are 16 bits. I found some difficulties on making my own filters due to the index or the size of the images. I am working with Textures because allows to work with any bit size of images. So, I am trying to compute an easy gradient to understand what is wrong or why it doesn't work as I expected. You can see that there is something wrong when I use y dir. For x: For y: That's my code: typedef concurrency::graphics::texture<unsigned int, 2> TextureData; typedef concurrency::graphics::texture_view<unsigned int, 2> Texture cv::Mat image =