diff --git a/samples/0_Intro/hcc_dialects/vadd_amp_arrayview.cpp b/samples/0_Intro/hcc_dialects/vadd_amp_arrayview.cpp deleted file mode 100644 index bb0a4157f8..0000000000 --- a/samples/0_Intro/hcc_dialects/vadd_amp_arrayview.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -*/ - -// Simple test showing how to use C++AMP syntax with array_view. -// The code uses AMP's array_view class, which provides automatic data synchronization -// of data between the host and the accelerator. As noted below, the HCC runtime -// will automatically copy data to and from the host, without the user needing -// to manually perform such copies. This is an excellent mode for developers -// new to GPU programming and matches the memory models provided by recent systems where -// CPU and GPU share the same memory pool. Advanced programmers may prefer -// more explicit control over the data movement - shown in the other vadd_hc_array and -// vadd_hc_am examples. -// This example shows the similarity between C++AMP and and HC for simple cases where -// implicit data transfer is used - really the only difference is the namespace. -// Other examples show some of the more advanced controls. - -#include - -int main(int argc, char* argv[]) { - int sizeElements = 1000000; - bool pass = true; - - // Allocate auto-managed host/device views of data: - concurrency::array_view A(sizeElements); - concurrency::array_view B(sizeElements); - concurrency::array_view C(sizeElements); - - // Initialize host data - for (int i = 0; i < sizeElements; i++) { - A[i] = 1.618f * i; - B[i] = 3.142f * i; - } - C.discard_data(); // tell runtime not to copy CPU host data. - - - // Launch kernel onto default accelerator - // The HCC runtime will ensure that A and B are available on the accelerator before launching - // the kernel. - concurrency::parallel_for_each(concurrency::extent<1>(sizeElements), - [=](concurrency::index<1> idx) restrict(amp) { - int i = idx[0]; - C[i] = A[i] + B[i]; - }); - - for (int i = 0; i < sizeElements; i++) { - float ref = 1.618f * i + 3.142f * i; - // Because C is an array_view, the HCC runtime will copy C back to host at first access - // here: - if (C[i] != ref) { - printf("error:%d computed=%6.2f, reference=%6.2f\n", i, C[i], ref); - pass = false; - } - }; - if (pass) printf("PASSED!\n"); -} diff --git a/samples/0_Intro/hcc_dialects/vadd_hc_am.cpp b/samples/0_Intro/hcc_dialects/vadd_hc_am.cpp index 65b38df099..9cfad779f9 100644 --- a/samples/0_Intro/hcc_dialects/vadd_hc_am.cpp +++ b/samples/0_Intro/hcc_dialects/vadd_hc_am.cpp @@ -26,8 +26,8 @@ THE SOFTWARE. // which can only be used on the device. The programmer has full control // over when data is copied. -#include -#include +#include +#include int main(int argc, char* argv[]) { int sizeElements = 1000000; diff --git a/samples/0_Intro/hcc_dialects/vadd_hc_array.cpp b/samples/0_Intro/hcc_dialects/vadd_hc_array.cpp index 5849e4e6c6..aff64528aa 100644 --- a/samples/0_Intro/hcc_dialects/vadd_hc_array.cpp +++ b/samples/0_Intro/hcc_dialects/vadd_hc_array.cpp @@ -27,7 +27,7 @@ THE SOFTWARE. // automatic data management capabilities - instead the programmer // takes the reins and controls when copies are executed. -#include +#include int main(int argc, char* argv[]) { int sizeElements = 1000000; diff --git a/samples/0_Intro/hcc_dialects/vadd_hc_array.hc b/samples/0_Intro/hcc_dialects/vadd_hc_array.hc index 9ed016c7ad..cd3d32fd4c 100644 --- a/samples/0_Intro/hcc_dialects/vadd_hc_array.hc +++ b/samples/0_Intro/hcc_dialects/vadd_hc_array.hc @@ -20,7 +20,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include +#include int main(int argc, char *argv[]) { diff --git a/samples/0_Intro/hcc_dialects/vadd_hc_arrayview.cpp b/samples/0_Intro/hcc_dialects/vadd_hc_arrayview.cpp index 4db3b2fea8..2d2089abc7 100644 --- a/samples/0_Intro/hcc_dialects/vadd_hc_arrayview.cpp +++ b/samples/0_Intro/hcc_dialects/vadd_hc_arrayview.cpp @@ -33,7 +33,7 @@ THE SOFTWARE. // implicit data transfer is used - really the only difference is the namespace. // Other examples show some of the more advanced controls. -#include +#include int main(int argc, char* argv[]) { int sizeElements = 1000000;