From e6717305fd5f22d07e679b4425345060b6492982 Mon Sep 17 00:00:00 2001 From: chsankar Date: Mon, 11 Oct 2021 15:19:35 +0530 Subject: [PATCH] Sparse: Api Guide renamed Sample application moved to examples folder. README for running sample application added. Signed-off-by: Chithra Sankar Change-Id: I6eec6b9f579c1293315cf3ded1a4ba2eef41b5fc --- ...PI Guide.pdf => aocl-sparse_API_Guide.pdf} | Bin library/include/aoclsparse_version.h.in | 2 +- tests/examples/README | 20 ++++++++++++++ tests/{ => examples}/sample_csrmv.cpp | 25 +++++++++--------- tests/test.sh | 5 ---- 5 files changed, 34 insertions(+), 18 deletions(-) rename docs/{aocl-sparse API Guide.pdf => aocl-sparse_API_Guide.pdf} (100%) create mode 100755 tests/examples/README rename tests/{ => examples}/sample_csrmv.cpp (88%) delete mode 100755 tests/test.sh diff --git a/docs/aocl-sparse API Guide.pdf b/docs/aocl-sparse_API_Guide.pdf similarity index 100% rename from docs/aocl-sparse API Guide.pdf rename to docs/aocl-sparse_API_Guide.pdf diff --git a/library/include/aoclsparse_version.h.in b/library/include/aoclsparse_version.h.in index f7a886a..72c5682 100644 --- a/library/include/aoclsparse_version.h.in +++ b/library/include/aoclsparse_version.h.in @@ -1,5 +1,5 @@ /* ************************************************************************ - * Copyright (c) 2020 Advanced Micro Devices, Inc. + * Copyright (c) 2020-2021 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/tests/examples/README b/tests/examples/README new file mode 100755 index 0000000..3f191cc --- /dev/null +++ b/tests/examples/README @@ -0,0 +1,20 @@ +/* +* Copyright (C) 2020-2021 Advanced Micro Devices, Inc. All rights reserved. +* +*/ +This directory contains sample source file showing sample usage of AMD Sparse +library functions. + +Steps to build and run the sample application: +1. Set AOCLSPARSE_ROOT to library installed path + export AOCLSPARSE_ROOT= + eg: export AOCLSPARSE_ROOT=$HOME/amd/aocl/3.0-5 + +2. Add aoclsparse shared library path to env path variable $LD_LIBRARY_PATH + export LD_LIBRARY_PATH=$AOCLSPARSE_ROOT/lib:$LD_LIBRARY_PATH + +3. Compile the sample appplication by linking to the aoclsparse library + g++ -O3 -DNDEBUG sample_csrmv.cpp -I $AOCLSPARSE_ROOT/include/ -L$AOCLSPARSE_ROOT/lib/ -laoclsparse -o test + +4. Run the application + ./test diff --git a/tests/sample_csrmv.cpp b/tests/examples/sample_csrmv.cpp similarity index 88% rename from tests/sample_csrmv.cpp rename to tests/examples/sample_csrmv.cpp index b73362c..85350c8 100644 --- a/tests/sample_csrmv.cpp +++ b/tests/examples/sample_csrmv.cpp @@ -1,16 +1,16 @@ /* ************************************************************************ - * Copyright (c) 2020 Advanced Micro Devices, Inc. - * + * Copyright (c) 2020-2021 Advanced Micro Devices, Inc. + * * 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 @@ -18,17 +18,18 @@ * 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. - * + * * ************************************************************************ */ #include "aoclsparse.h" #include +#define M 5 +#define N 5 +#define NNZ 8 + int main(int argc, char* argv[]) { - aoclsparse_int M = 5; - aoclsparse_int N = 5; - aoclsparse_int nnz = 8; aoclsparse_operation trans = aoclsparse_operation_none; double alpha = 1.0; @@ -48,19 +49,19 @@ int main(int argc, char* argv[]) // Initialise matrix aoclsparse_int csr_row_ptr[M+1] = {0, 2, 3, 4, 7, 8}; - aoclsparse_int csr_col_ind[nnz]= {0, 3, 1, 2, 1, 3, 4, 4}; - double csr_val[nnz] = {1 , 6 , 1.050e+01, 1.500e-02, 2.505e+02, -2.800e+02 , 3.332e+01 , 1.200e+01}; + aoclsparse_int csr_col_ind[NNZ]= {0, 3, 1, 2, 1, 3, 4, 4}; + double csr_val[NNZ] = {1 , 6 , 1.050e+01, 1.500e-02, 2.505e+02, -2.800e+02 , 3.332e+01 , 1.200e+01}; // Initialise vectors double x[N] = { 1.0, 2.0, 3.0, 4.0, 5.0}; double y[M]; - + std::cout << "Invoking aoclsparse_dcsrmv.."; //Invoke SPMV API for CSR storage format(double precision) aoclsparse_dcsrmv(trans, &alpha, M, N, - nnz, + NNZ, csr_val, csr_col_ind, csr_row_ptr, diff --git a/tests/test.sh b/tests/test.sh deleted file mode 100755 index 0c4c298..0000000 --- a/tests/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#Set AOCLSPARSE_ROOT to library installed path -#export AOCLSPARSE_ROOT= -#Add aoclsparse shared library path to env path variable $LD_LIBRARY_PATH -#export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH -g++ -O3 -DNDEBUG sample_csrmv.cpp -I $AOCLSPARSE_ROOT/include/ -L$AOCLSPARSE_ROOT/lib/ -laoclsparse -o test