-
Notifications
You must be signed in to change notification settings - Fork 17
/
printGRiD.py
executable file
·50 lines (43 loc) · 1.56 KB
/
printGRiD.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python3
from URDFParser import URDFParser
from GRiDCodeGenerator import GRiDCodeGenerator
from util import parseInputs, printUsage, validateRobot, initializeValues
import subprocess
import sys
def main():
inputs = parseInputs(NO_ARG_OPTION = True)
if not inputs is None:
URDF_PATH, DEBUG_MODE, FILE_NAMESPACE_NAME = inputs
parser = URDFParser()
robot = parser.parse(URDF_PATH)
validateRobot(robot, NO_ARG_OPTION = True)
codegen = GRiDCodeGenerator(robot,DEBUG_MODE,True, FILE_NAMESPACE = FILE_NAMESPACE_NAME)
print("-----------------")
print("Generating GRiD.cuh")
print("-----------------")
codegen.gen_all_code()
print("New code generated and saved to grid.cuh!")
print("-----------------")
print("Compiling printGRiD")
print("-----------------")
result = subprocess.run( \
["nvcc", "-std=c++11", "-o", "printGRiD.exe", "printGRiD.cu", \
"-gencode", "arch=compute_86,code=sm_86", \
"-O3", "-ftz=true", "-prec-div=false", "-prec-sqrt=false"], \
capture_output=True, text=True \
)
if result.stderr:
print("Compilation errors follow:")
print(result.stderr)
exit()
print("-----------------")
print("Running printGRiD")
print("-----------------")
result = subprocess.run(["./printGRiD.exe"], capture_output=True, text=True)
if result.stderr:
print("Runtime errors follow:")
print(result.stderr)
exit()
print(result.stdout)
if __name__ == "__main__":
main()