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

fix compiler error

parent 1abedd1c
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ def parse_tasks(args):
)
# dump the wrapper for vector
outFile.write(GPUTaskParams.dump_struct_wrapper())
#outFile.write(GPUTaskParams.dump_struct_wrapper())
# dump the gputask structure here
outFile.write(GPUTaskParams.dump_struct())
for line in inFileLines:
......@@ -64,7 +64,7 @@ def parse_tasks(args):
list_gpu_tasks_object.append(currTask)
outFile.write(currTask.dump_str() + "\n")
relation_task_id_task_name[currTask.task_id] = currTask.name
outFile.write(GPUTaskParams.dump_global_vector())
#outFile.write(GPUTaskParams.dump_global_vector())
outFile.write("#endif")
print("gpu_tasks.hpp file generated")
......
......@@ -36,7 +36,7 @@ class GPUTaskParams:
# GENERAL params
TASK_ID_IMPL = "\t.task_id = {task_id},\n"
FUNCTION_IMPL = "\t.{name}=&{kernel_name},\n"
FUNCTION_IMPL = "\t.{name}=&{kernel_name},\n" # remove this never call it
# @TODO add here FUNCTION ARGUMENTS
NAME_IMPL = "\t.kernel_name = std::string(\"{name}\")\n"
......@@ -57,8 +57,9 @@ class GPUTaskParams:
WRAPPER_STRUCT_NAME = "gpusched_wrapper_task_t"
def dump_struct():
dump = "template<typename ...Types>\n"
dump += "struct {struct_name}: public {wrapper_name} {{\n".format(struct_name=GPUTaskParams.STRUCT_NAME, wrapper_name=GPUTaskParams.WRAPPER_STRUCT_NAME)
#dump = "template<typename ...Types>\n"
#dump += "struct {struct_name}: public {wrapper_name} {{\n".format(struct_name=GPUTaskParams.STRUCT_NAME, wrapper_name=GPUTaskParams.WRAPPER_STRUCT_NAME)
dump = "struct {struct_name}{{\n".format(struct_name=GPUTaskParams.STRUCT_NAME)
dump = dump + GPUTaskParams.WCET
dump = dump + GPUTaskParams.PERIOD
dump = dump + GPUTaskParams.DEADLINE
......@@ -69,7 +70,7 @@ class GPUTaskParams:
dump = dump + GPUTaskParams.SMEM
dump = dump + "\t// general attributes\n"
dump = dump + GPUTaskParams.TASK_ID
dump = dump + GPUTaskParams.FUNCTION
#dump = dump + GPUTaskParams.FUNCTION
dump = dump + GPUTaskParams.NAME
dump = dump + "};\n"
return dump
......@@ -78,7 +79,7 @@ class GPUTaskParams:
dump = "struct {wrapper_name}{{}};\n\n".format(wrapper_name=GPUTaskParams.WRAPPER_STRUCT_NAME)
return dump
# global vector is useless for now
def dump_global_vector():
dump = "static std::vector<std::shared_ptr<{wrapper_name}> >& get_gpusched_task_vector() {{\n".format(wrapper_name=GPUTaskParams.WRAPPER_STRUCT_NAME)
dump += "\tstd::vector<std:::shared_ptr<{wrapper_name}> > gpu_tasks;\n".format(wrapper_name=GPUTaskParams.WRAPPER_STRUCT_NAME)
......@@ -133,7 +134,7 @@ class GPUTask:
dump = dump + GPUTaskParams.SMEM_IMPL.format(smem=self.smem)
dump = dump + "\t// general attributes\n"
dump = dump + GPUTaskParams.TASK_ID_IMPL.format(task_id=self.task_id)
dump = dump + GPUTaskParams.FUNCTION_IMPL.format(name='f', kernel_name = self.name, params=self.get_kernel_declaration())
#dump = dump + GPUTaskParams.FUNCTION_IMPL.format(name='f', kernel_name = self.name, params=self.get_kernel_declaration())
dump = dump + GPUTaskParams.NAME_IMPL.format(name=self.name)
dump = dump + "};\n"
......@@ -188,6 +189,3 @@ class GPUTask:
parameter = (parameter.split(" ")[-1]).rstrip(';\n')
self.kernel_parameters_variable.append(parameter)
self.init_function_name = init_name.split("void")[1].lstrip().rstrip(" {\n")
......@@ -35,8 +35,9 @@ def generate_main_unroll_step():
unroll += "\tcudaDeviceSynchronize();\n\n"
if i != len(list_gpusched_step_object) - 1:
unroll += "\tstep_end = high_resolution_clock::now();\n"
unroll += "\tprintf(\"After step {no} at time %d\",step_end.count()),\n"
unroll += "\telapsed_time = step_end - base;\n"
unroll += "\telapsed_time_ms = duration_cast<ms>(elasped_time);\n"
unroll += "\telapsed_time_ms = duration_cast<ms>(elapsed_time);\n"
unroll += "\tidle_time = milliseconds({next_step_min_time}) - elapsed_time_ms;\n".format(next_step_min_time=list_gpusched_step_object[i+1].min_time_start)
unroll += "\tif (idle_time.count() > 0)\n\t\tstd::this_thread::sleep_for(idle_time);\n"
......@@ -61,14 +62,14 @@ def generate_cudaStreams():
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 += "\tusing namespace std::chrono;\n";
chrono_dump += "\ttypedef duration<double> dsec;\n";
chrono_dump += "\ttypedef milliseconds ms;\n";
chrono_dump += "\tdsec elapsed_time;\n"
chrono_dump += "\tms elapsed_time_ms;\n"
chrono_dump += "\tint idle_time;\n"
chrono_dump += "\tms idle_time;\n"
chrono_dump += "\thigh_resolution_clock::time_point step_end;\n"
chrono_dump += "\thigh_resolution_clock::time_point base = high_resolution_block::now();\n"
chrono_dump += "\thigh_resolution_clock::time_point base = high_resolution_clock::now();\n"
return chrono_dump
......@@ -81,13 +82,13 @@ def write_main(args):
"#include <thread>\n"
"#include \"steps_struct.hpp\"\n"
"#include \"gpu_tasks.hpp\"\n"
"#include \"{kernel_file}\"\n".format(kernel_file=args.kernel_declaration)
#"#include \"{kernel_file}\"\n".format(kernel_file=args.kernel_declaration)
)
outFile.write("int main(int argc, char **argv){\n"
"\tauto gputasks = get_gpusched_task_vector();\n"
"\tauto steps = get_gpusched_steps();\n"
"\tprintf(\"Start the execution of GPUSCHED order\");\n"
"\tprintf(\"There is %d steps to execute\", steps.size());\n"
"\tprintf(\"Start the execution of GPUSCHED order\\n\");\n"
"\tprintf(\"There is %d steps to execute\", steps.size()\\n);\n"
)
outFile.write(generate_cudaStreams())
outFile.write(write_timer_initialization())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment