summaryrefslogtreecommitdiff
path: root/scripts/database
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-12-27 12:04:22 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-12-27 12:04:22 +0100
commit1e738db6dd84d552550a15473abdda83e88f4c80 (patch)
tree44bd0c99699ed66203348fd1401e3b5bb3497eee /scripts/database
parent4a2fc4aa989ce84dc476cf9508adb676a042896b (diff)
Split the database into multiple small compilation units
Diffstat (limited to 'scripts/database')
-rw-r--r--scripts/database/database/clblast.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/scripts/database/database/clblast.py b/scripts/database/database/clblast.py
index 40e67b55..6625c808 100644
--- a/scripts/database/database/clblast.py
+++ b/scripts/database/database/clblast.py
@@ -90,13 +90,29 @@ def get_cpp_device_vendor(vendor, device_type):
def get_cpp_family_includes(family, precisions):
result = "\n"
- # result += "#include \"clblast.h\"\n"
- # result += "#include \"database/database_structure.hpp\"\n"
+ result += "#include \"database/kernels/%s/%s.hpp\"\n" % (family, family)
for precision in precisions:
result += "#include \"database/kernels/%s/%s_%s.hpp\"\n" % (family, family, precision)
return result
+def get_hpp_family_includes(family, precisions):
+ result = "\n"
+ result += "#include \"database/database_structure.hpp\"\n"
+ result += "\n"
+ result += "namespace clblast {\n"
+ result += "namespace database {\n"
+ result += "\n"
+ camelcase_name = family.title().replace("_", "")
+ for precision in precisions:
+ precision_string = precision_to_string(precision)
+ result += "extern const DatabaseEntry %s%s;\n" % (camelcase_name, precision_string)
+ result += "\n"
+ result += "} // namespace database\n"
+ result += "} // namespace clblast\n"
+ return result
+
+
def print_as_name(name):
return "Name{\"%-50s\"}" % name.strip()[:STRING_LENGTH]
@@ -238,8 +254,14 @@ def print_cpp_database(database, output_dir):
# Prints the file footer
f.write(get_cpp_footer())
+ # Creates the combined family sources
+ full_path = os.path.join(family_path, family_name + ".cpp")
+ with open(full_path, 'w+') as f:
+ f.write(get_cpp_header(family_name, ""))
+ f.write(get_cpp_family_includes(family_name, precisions))
+
# Creates the combined family includes header
full_path = os.path.join(family_path, family_name + ".hpp")
with open(full_path, 'w+') as f:
f.write(get_cpp_header(family_name, ""))
- f.write(get_cpp_family_includes(family_name, precisions))
+ f.write(get_hpp_family_includes(family_name, precisions))