MAGMA  1.2.0
MatrixAlgebraonGPUandMulticoreArchitectures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
s2z Namespace Reference

Functions

def freplace
def main

Function Documentation

def s2z.freplace (   fname,
  from_pattern,
  to_pattern 
)

Definition at line 4 of file s2z.py.

4 
5 def freplace(fname, from_pattern, to_pattern):
6  data = open(fname).read().replace(from_pattern, to_pattern)
7  open(fname, "w").write(data)

Here is the caller graph for this function:

def s2z.main (   argv)

Definition at line 8 of file s2z.py.

References freplace().

8 
9 def main(argv):
10  for fname in argv[1:]:
11  head, rest = os.path.split(fname)
12  zfname = os.path.join(head, "z" + rest[1:]) # assumes "z" should go in the beginning of file name
13 
14  freplace(fname, "November 2010\n*/", "November 2010\n\n@precisions normal s -> z d c\n*/")
15  os.system("python %s -p z --file %s" % (os.environ.get("PATH_TO_CODEGEN_PY", "codegen.py"), fname))
16  freplace(zfname, "@generated z", "@precisions normal z -> s d c")
17 
18  return 0
19 
20 sys.exit(main(sys.argv))

Here is the call graph for this function: