Skip to content

Commit

Permalink
add cmd args
Browse files Browse the repository at this point in the history
  • Loading branch information
mrprajesh committed Mar 28, 2024
1 parent 98e434b commit 6ae5ab9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Accelerating Computation of Steiner Trees on GPUs at [https://doi.org/10.1007/s1
## Publication

**Accelerating Computation of Steiner Trees on GPUs**,

<ins>Rajesh Pandian M </ins>, Rupesh Nasre. and N.S. Narayanaswamy,

*International Journal of Parallel Programming* **(IJPP)**, Volume 50, pages 152–185, **(2022)**

[(DOI)](https://doi.org/10.1007/s10766-021-00723-0) [(Slides)](https://mrprajesh.co.in/pdfs/sem2-v4.pdf) [(Video)](https://youtu.be/BIecDhPdWaQ) [(Code)](https://github.com/mrprajesh/gpuSteiner)
Expand All @@ -18,21 +20,30 @@ Accelerating Computation of Steiner Trees on GPUs at [https://doi.org/10.1007/s1

## Requirements

- Should work on every Linux Distribution. Tested on Ubuntu 22.04.
- Should work on every Linux Distribution. Tested on Ubuntu 22.04 and P100.
- Assumes Pascal+ Nvidia GPU and CUDA 10+ installed at default location.
- GCC 7+

## How to run
## How to use

### Build and run the executables

```
## To compile for GPU & seqCPU version
make
## To run on seqCPU
./2approxCpu2.out < tcSelected/instance137.gr
# to run on GPU
./gpuSteiner6-oddAgainWithKtimer2Sh3.out 16 < tcSelected/instance137.gr.txt
```

## Authors
* Rajesh Pandian M | https://mrprajesh.co.in
* Rupesh Nasre | www.cse.iitm.ac.in/~rupesh
* N.S.Narayanaswamy| www.cse.iitm.ac.in/~swamy
* Rajesh Pandian M | https://mrprajesh.co.in
* Rupesh Nasre | www.cse.iitm.ac.in/~rupesh
* N.S.Narayanaswamy | www.cse.iitm.ac.in/~swamy


# LICENSE
Expand Down
16 changes: 10 additions & 6 deletions gpuSteiner6-oddAgainWithKtimer2Sh3.cu
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,19 @@ bool printHash = false;

int main(int argc, char** argv) {
if (argc == 1) {
printf("Usage: %s n -p\nn: #SSSPs in parallel. Default n=2\n", argv[0]);
printf("Usage: %s <p> -v < tcSelected/instance137.gr.txt \n\
p: # of SSSPs in parallel. \n\
-v: prints steiner tree edges. Default: Steiner VALUE and times\n\
E.g. ./gpuSteiner6-oddAgainWithKtimer2Sh3.out 16 < tcSelected/instance137.gr.txt
", argv[0]);
exit(0);
}
if (argc > 1) {
if (argc > 0) {
//~ printEdges=true; //prints edges
sCount = ((atoi(argv[1]) == 0) ? 2 : atoi(argv[1]));
sCount = ((atoi(argv[1]) == 0) ? 2 : atoi(argv[1])); //DEFAULT IS 2
printHash = true;
}
if (argc > 2) {
if (argc > 2) { // infact any 3rd will do.
printEdges = true;
}

Expand Down Expand Up @@ -339,7 +343,7 @@ void MSTGraph(int t, int* terminals, map<pair<int, int>, int>& W, set<pair<int,
printf("%d %d\n", v1 + 1, v2 + 1);
}
}
printf("VALUE %d,%f\n", mstVal, totalTimeMilliSec);
printf("VALUE %d,%f ms\n", mstVal, totalTimeMilliSec);
}

//! freeMem(); // This frees the GPU memory as well! OMG!
Expand Down Expand Up @@ -489,7 +493,7 @@ void MSTGraphG2(set<pair<int, int>>& stEdges, set<int>& nodeSet, map<pair<int, i
}
// For each terminal on their respective parent array!

printf("VALUE %d,%f, %f\n", minimumCost, totalTimeMilliSec, milliseconds);
printf("VALUE %d,%f ms, %f ms\n", minimumCost, totalTimeMilliSec, milliseconds);

DEBUG printf("in MST Graph2\n");
freeMem();
Expand Down

0 comments on commit 6ae5ab9

Please sign in to comment.