Skip to content
Snippets Groups Projects
Commit e2584478 authored by Nordine Feddal's avatar Nordine Feddal
Browse files

added timer initialization

parent 8173e3c3
Branches
No related tags found
No related merge requests found
...@@ -48,12 +48,24 @@ def generate_cudaStreams(): ...@@ -48,12 +48,24 @@ def generate_cudaStreams():
for i in range(0, stream_number): for i in range(0, stream_number):
dump_stream += "\tcudaStreamCreate(&{name});\n".format(name=stream_name.format(no=i)) dump_stream += "\tcudaStreamCreate(&{name});\n".format(name=stream_name.format(no=i))
dump_stream += "\n"
return dump_stream return dump_stream
def write_timer_initialization():
chrono_dump = "\t// Initialize timer\n"
chrono_dump += "\tusing namespace std::chrono\n";
chrono_dump += "\ttypedef duration<double> dsec\n";
chrono_dump += "\ttypedef milliseconds ms;\n";
chrono_dump += "\thigh_resolution_clock::time_point step_end;\n"
chrono_dump += "\thigh_resolution_clock::time_point base = high_resolution_block::now();\n"
return chrono_dump
def write_main(args): def write_main(args):
with open(args.output_file, "a") as outFile: with open(args.output_file, "a") as outFile:
# Start message # Start message
outFile.write("#include <stdio.h>\n" outFile.write("#include <stdio.h>\n"
"#include <chrono>\n"
"#include <string>\n" "#include <string>\n"
"#include \"steps_struct.hpp\"\n" "#include \"steps_struct.hpp\"\n"
"#include \"gpu_tasks.hpp\"\n" "#include \"gpu_tasks.hpp\"\n"
...@@ -66,6 +78,7 @@ def write_main(args): ...@@ -66,6 +78,7 @@ def write_main(args):
"\tprintf(\"There is %d steps to execute\", steps.size());\n" "\tprintf(\"There is %d steps to execute\", steps.size());\n"
) )
outFile.write(generate_cudaStreams()) outFile.write(generate_cudaStreams())
outFile.write(write_timer_initialization())
outFile.write(generate_main_unroll_step()) outFile.write(generate_main_unroll_step())
outFile.write('}') outFile.write('}')
...@@ -79,7 +92,6 @@ def main(): ...@@ -79,7 +92,6 @@ def main():
parser.add_argument('-o', '--output_file', type=str, default='gpusched_impl.cu', help='Output file containing the implementation of GPUSCHED') parser.add_argument('-o', '--output_file', type=str, default='gpusched_impl.cu', help='Output file containing the implementation of GPUSCHED')
parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.1') parser.add_argument('-v', '--version', action='version', version='%(prog)s 0.1')
#@TODO add a check for -t -j -s -k mandatory parameter
args = parser.parse_args() args = parser.parse_args()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment