Skip to content

Commit

Permalink
Sparse: Api Guide renamed
Browse files Browse the repository at this point in the history
Sample application moved to examples folder.
README for running sample application added.

Signed-off-by: Chithra Sankar <[email protected]>
Change-Id: I6eec6b9f579c1293315cf3ded1a4ba2eef41b5fc
  • Loading branch information
chsankar committed Oct 11, 2021
1 parent 9339fb7 commit e671730
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 18 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion library/include/aoclsparse_version.h.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 20 additions & 0 deletions tests/examples/README
Original file line number Diff line number Diff line change
@@ -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=<path to AOCL install directory>
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
25 changes: 13 additions & 12 deletions tests/sample_csrmv.cpp → tests/examples/sample_csrmv.cpp
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
/* ************************************************************************
* 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
* 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.
*
*
* ************************************************************************ */

#include "aoclsparse.h"
#include <iostream>

#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;
Expand All @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions tests/test.sh

This file was deleted.

0 comments on commit e671730

Please sign in to comment.