Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support graph 64-bit edge number #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

CC=g++
NC=nvcc
CFLAGS=-std=c++11 -O3
NFLAGS=-arch=sm_60
CFLAGS=-std=c++14 -O3

#Tesla T4: sm_75 A100: sm_80
NFLAGS=-arch=sm_75

SHARED=shared
SUBWAY=subway
Expand All @@ -14,13 +16,13 @@ DEP=$(SHARED)/timer.o $(SHARED)/argument_parsing.o $(SHARED)/graph.o $(SHARED)/s
all: make1 make2 make3 bfs-sync cc-sync sssp-sync sswp-sync pr-sync bfs-async cc-async sssp-async sswp-async pr-async

make1:
make -C $(SHARED)
make -C $(SHARED) NFLAGS=${NFLAGS}

make2:
make -C $(SUBWAY)
make -C $(SUBWAY) NFLAGS=${NFLAGS}

make3:
make -C $(TOOLS)
make -C $(TOOLS) NFLAGS=${NFLAGS}


bfs-sync: $(SUBWAY)/bfs-sync.o $(DEP)
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ Graph.wel ("SOURCE DESTINATION WEIGHT" for each edge in each line):
1 2 10
```

TAB is used as delimiter in both el and wel graph format.

To convert these graph files to the binary format, run the following commands in the root folder:
```
tools/converter path_to_Graph.el
tools/converter path_to_Graph.wel
cat path_to_Graph.el|tools/converter_stdin el output_filename.bcsr
cat path_to_Graph.wel|tools/converter_stdin wel output_filename.bwcsr
```

The first command converts Graph.el to the binary CSR format and generates a binary graph file with .bcsr extension under the same directory as the original file. The second command converts Graph.wel to a weighted binary graph file with .bwcsr extension.
The first command converts Graph.el to the binary CSR format and generates a binary graph file with bcsr extension. The second command converts Graph.wel to a weighted binary graph file with .bwcsr extension.

#### Running applications in Subway
The applications take a graph as input as well as some optional arguments. For example:
Expand Down
4 changes: 2 additions & 2 deletions shared/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CC=g++
NC=nvcc
CFLAGS=-std=c++11 -O3
NFLAGS=-arch=sm_60
CFLAGS=-std=c++14 -O3
#NFLAGS=-arch=sm_80


all: timer.o argument_parsing.o graph.o subgraph.o partitioner.o subgraph_generator.o gpu_kernels.o subway_utilities.o test.o
Expand Down
212 changes: 106 additions & 106 deletions shared/argument_parsing.cu
Original file line number Diff line number Diff line change
Expand Up @@ -4,117 +4,117 @@

ArgumentParser::ArgumentParser(int argc, char **argv, bool canHaveSource, bool canHaveItrs)
{
this->argc = argc;
this->argv = argv;
this->canHaveSource = canHaveSource;
this->canHaveItrs = canHaveItrs;
this->sourceNode = 0;
this->deviceID = 0;
this->numberOfItrs = 1;
hasInput = false;
hasSourceNode = false;
hasOutput = false;
hasDeviceID = false;
hasNumberOfItrs = false;
Parse();
this->argc = argc;
this->argv = argv;
this->canHaveSource = canHaveSource;
this->canHaveItrs = canHaveItrs;
this->sourceNode = 0;
this->deviceID = 0;
this->numberOfItrs = 1;
hasInput = false;
hasSourceNode = false;
hasOutput = false;
hasDeviceID = false;
hasNumberOfItrs = false;
Parse();
}
bool ArgumentParser::Parse()
{
try
{
if(argc == 1)
{
cout << GenerateHelpString();
exit(0);
}
if(argc == 2)
if ((strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-help") == 0) ||
(strcmp(argv[1], "--h") == 0) ||
(strcmp(argv[1], "-h") == 0))
{
cout << GenerateHelpString();
exit(0);
}
if(argc%2 == 0)
{
cout << "\nThere was an error parsing command line arguments\n";
cout << GenerateHelpString();
exit(0);
}
for(int i=1; i<argc-1; i=i+2)
{
//argv[i]
if (strcmp(argv[i], "--input") == 0) {
input = string(argv[i+1]);
hasInput = true;
}
else if (strcmp(argv[i], "--output") == 0) {
output = string(argv[i+1]);
hasOutput = true;
}
else if (strcmp(argv[i], "--source") == 0 && canHaveSource) {
sourceNode = atoi(argv[i+1]);
hasSourceNode = true;
}
else if (strcmp(argv[i], "--device") == 0) {
deviceID = atoi(argv[i+1]);
hasDeviceID = true;
cudaSetDevice(deviceID);
}
else if (strcmp(argv[i], "--iteration") == 0 && canHaveItrs) {
numberOfItrs = atoi(argv[i+1]);
hasNumberOfItrs = true;
}
else
{
cout << "\nThere was an error parsing command line argument <" << argv[i] << ">\n";
cout << GenerateHelpString();
exit(0);
}
}
if(hasInput)
return true;
else
{
cout << "\nInput graph file argument is required.\n";
cout << GenerateHelpString();
exit(0);
}
}
catch( const std::exception& strException ) {
std::cerr << strException.what() << "\n";
GenerateHelpString();
exit(0);
}
catch(...) {
std::cerr << "An exception has occurred.\n";
GenerateHelpString();
exit(0);
}
try
{
if(argc == 1)
{
cout << GenerateHelpString();
exit(0);
}
if(argc == 2)
if ((strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-help") == 0) ||
(strcmp(argv[1], "--h") == 0) ||
(strcmp(argv[1], "-h") == 0))
{
cout << GenerateHelpString();
exit(0);
}
if(argc%2 == 0)
{
cout << "\nThere was an error parsing command line arguments\n";
cout << GenerateHelpString();
exit(0);
}
for(int i=1; i<argc-1; i=i+2)
{
//argv[i]
if (strcmp(argv[i], "--input") == 0) {
input = string(argv[i+1]);
hasInput = true;
}
else if (strcmp(argv[i], "--output") == 0) {
output = string(argv[i+1]);
hasOutput = true;
}
else if (strcmp(argv[i], "--source") == 0 && canHaveSource) {
sourceNode = atoi(argv[i+1]);
hasSourceNode = true;
}
else if (strcmp(argv[i], "--device") == 0) {
deviceID = atoi(argv[i+1]);
hasDeviceID = true;
cudaSetDevice(deviceID);
}
else if (strcmp(argv[i], "--iteration") == 0 && canHaveItrs) {
numberOfItrs = atoi(argv[i+1]);
hasNumberOfItrs = true;
}
else
{
cout << "\nThere was an error parsing command line argument <" << argv[i] << ">\n";
cout << GenerateHelpString();
exit(0);
}
}
if(hasInput)
return true;
else
{
cout << "\nInput graph file argument is required.\n";
cout << GenerateHelpString();
exit(0);
}
}
catch( const std::exception& strException ) {
std::cerr << strException.what() << "\n";
GenerateHelpString();
exit(0);
}
catch(...) {
std::cerr << "An exception has occurred.\n";
GenerateHelpString();
exit(0);
}
}

string ArgumentParser::GenerateHelpString(){
string str = "\nRequired arguments:";
str += "\n [--input]: Input graph file. E.g., --input FacebookGraph.txt";
str += "\nOptional arguments";
if(canHaveSource)
str += "\n [--source]: Begins from the source (Default: 0). E.g., --source 10";
str += "\n [--output]: Output file for results. E.g., --output results.txt";
str += "\n [--device]: Select GPU device (default: 0). E.g., --device 1";
if(canHaveItrs)
str += "\n [--iteration]: Number of iterations (default: 1). E.g., --iterations 10";
str += "\n\n";
return str;
string str = "\nRequired arguments:";
str += "\n [--input]: Input graph file. E.g., --input FacebookGraph.txt";
str += "\nOptional arguments";
if(canHaveSource)
str += "\n [--source]: Begins from the source (Default: 0). E.g., --source 10";
str += "\n [--output]: Output file for results. E.g., --output results.txt";
str += "\n [--device]: Select GPU device (default: 0). E.g., --device 1";
if(canHaveItrs)
str += "\n [--iteration]: Number of iterations (default: 1). E.g., --iterations 10";
str += "\n\n";
return str;
}

50 changes: 25 additions & 25 deletions shared/argument_parsing.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,31 @@ class ArgumentParser
private:

public:
int argc;
char** argv;
bool canHaveSource;
bool canHaveItrs;
bool hasInput;
bool hasSourceNode;
bool hasOutput;
bool hasDeviceID;
bool hasNumberOfItrs;
string input;
int sourceNode;
string output;
int deviceID;
int numberOfItrs;
ArgumentParser(int argc, char **argv, bool canHaveSource, bool canHaveItrs);
bool Parse();
string GenerateHelpString();
int argc;
char** argv;
bool canHaveSource;
bool canHaveItrs;
bool hasInput;
bool hasSourceNode;
bool hasOutput;
bool hasDeviceID;
bool hasNumberOfItrs;
string input;
int sourceNode;
string output;
int deviceID;
int numberOfItrs;
ArgumentParser(int argc, char **argv, bool canHaveSource, bool canHaveItrs);
bool Parse();
string GenerateHelpString();
};


#endif // ARGUMENT_PARSING_HPP
#endif // ARGUMENT_PARSING_HPP
6 changes: 3 additions & 3 deletions shared/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ struct OutEdgeWeighted{
};

struct Edge{
uint source;
uint source;
uint end;
};

struct EdgeWeighted{
uint source;
uint source;
uint end;
uint w8;
};




#endif // GLOBALS_HPP
#endif // GLOBALS_HPP
6 changes: 3 additions & 3 deletions shared/gpu_error_check.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef GPU_ERROR_CHECK_CUH
#define GPU_ERROR_CHECK_CUH
#ifndef GPU_ERROR_CHECK_CUH
#define GPU_ERROR_CHECK_CUH

//#include <string>
//#include <sstream>
Expand All @@ -15,4 +15,4 @@ inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=t
}
}

#endif // GPU_ERROR_CHECK_CUH
#endif // GPU_ERROR_CHECK_CUH
Loading