Example #1
0
 def __init__(O, compiler=None):
     if (os.name == "nt"):
         O.compiler = "cl"
         O.obj_suffix = ".obj"
         O.exe_suffix = ".exe"
         O.pch_suffix = None
     else:
         O.compiler = "g++"
         O.obj_suffix = ".o"
         O.exe_suffix = ""
         O.pch_suffix = ".gch"
     if (compiler is not None):
         O.compiler = compiler
     compiler_from_os_environ = os.environ.get("FABLE_COMPILER")
     if (compiler_from_os_environ is not None):
         O.compiler = compiler_from_os_environ
     from libtbx.path import full_command_path
     O.compiler_path = full_command_path(command=O.compiler + O.exe_suffix)
     import libtbx.load_env
     if (O.compiler == "g++" and O.compiler_path is not None):
         O.gcc_version = libtbx.env_config.get_gcc_version(
             command_name=O.compiler)
     else:
         O.gcc_version = None
     O.fable_dist = libtbx.env.dist_path(module_name="fable")
     if (op.isdir(op.join(O.fable_dist, "tbxx"))):
         O.tbxx_root = None
     else:
         O.tbxx_root = op.dirname(libtbx.env.dist_path(module_name="tbxx"))
     O.__have_pch = False
 def __init__(O, compiler=None):
   if (os.name == "nt"):
     O.compiler = "cl"
     O.obj_suffix = ".obj"
     O.exe_suffix = ".exe"
     O.pch_suffix = None
   else:
     O.compiler = "g++"
     O.obj_suffix = ".o"
     O.exe_suffix = ""
     O.pch_suffix = ".gch"
   if (compiler is not None):
     O.compiler = compiler
   compiler_from_os_environ = os.environ.get("FABLE_COMPILER")
   if (compiler_from_os_environ is not None):
     O.compiler = compiler_from_os_environ
   from libtbx.path import full_command_path
   O.compiler_path = full_command_path(command=O.compiler+O.exe_suffix)
   import libtbx.load_env
   if (O.compiler == "g++" and O.compiler_path is not None):
     O.gcc_version = libtbx.env_config.get_gcc_version(
       command_name=O.compiler)
   else:
     O.gcc_version = None
   O.fable_dist = libtbx.env.dist_path(module_name="fable")
   if (op.isdir(op.join(O.fable_dist, "tbxx"))):
     O.tbxx_root = None
   else:
     O.tbxx_root = op.dirname(libtbx.env.dist_path(module_name="tbxx"))
   O.__have_pch = False
Example #3
0
def run_combinations(
      compiler_versions,
      all_utimes,
      a_out_archive,
      write_a_out_archive,
      n_scatt,
      n_refl,
      compiler_build_opts_list,
      real_list,
      write_build_run):
  for compiler,build_opts in compiler_build_opts_list:
    if (write_a_out_archive):
      have_compiler = (full_command_path(command=compiler) is not None)
      if (not have_compiler):
        compiler_version = "n/a"
      else:
        compiler_version = easy_run.fully_buffered(
          command=compiler+" --version",
          join_stdout_stderr=True).stdout_lines[0]
      compiler_versions.append(compiler_version)
      a_out = None
    build_cmd = " ".join([compiler, build_opts])
    print build_cmd
    utimes = []
    for real in real_list:
      print "  %s" % real
      for replace_cos in [False, True]:
        print "    replace_cos", replace_cos
        for replace_exp in [False, True]:
          print "      replace_exp", replace_exp
          sys.stdout.flush()
          a_out_key = (build_cmd, replace_cos, replace_exp)
          if (not write_a_out_archive):
            compiler_version, a_out = a_out_archive.get(a_out_key, (
              "n/a", None))
          if (compiler_version != "n/a"):
            utime = write_build_run(
              a_out=a_out,
              n_scatt=n_scatt,
              n_refl=n_refl,
              real=real,
              build_cmd=build_cmd,
              replace_cos=replace_cos,
              replace_exp=replace_exp)
            print "        %4.2f" % utime
            if (write_a_out_archive):
              a_out_archive[a_out_key] = (
                compiler_version,
                open("a.out", "rb").read())
          else:
            utime = -1.0
            print "        n/a"
          utimes.append(utime)
          sys.stdout.flush()
    all_utimes.append(utimes)
Example #4
0
def run_combinations(compiler_versions, all_utimes, a_out_archive,
                     write_a_out_archive, n_scatt, n_refl,
                     compiler_build_opts_list, real_list, write_build_run):
    for compiler, build_opts in compiler_build_opts_list:
        if (write_a_out_archive):
            have_compiler = (full_command_path(command=compiler) is not None)
            if (not have_compiler):
                compiler_version = "n/a"
            else:
                compiler_version = easy_run.fully_buffered(
                    command=compiler + " --version",
                    join_stdout_stderr=True).stdout_lines[0]
            compiler_versions.append(compiler_version)
            a_out = None
        build_cmd = " ".join([compiler, build_opts])
        print build_cmd
        utimes = []
        for real in real_list:
            print "  %s" % real
            for replace_cos in [False, True]:
                print "    replace_cos", replace_cos
                for replace_exp in [False, True]:
                    print "      replace_exp", replace_exp
                    sys.stdout.flush()
                    a_out_key = (build_cmd, replace_cos, replace_exp)
                    if (not write_a_out_archive):
                        compiler_version, a_out = a_out_archive.get(
                            a_out_key, ("n/a", None))
                    if (compiler_version != "n/a"):
                        utime = write_build_run(a_out=a_out,
                                                n_scatt=n_scatt,
                                                n_refl=n_refl,
                                                real=real,
                                                build_cmd=build_cmd,
                                                replace_cos=replace_cos,
                                                replace_exp=replace_exp)
                        print "        %4.2f" % utime
                        if (write_a_out_archive):
                            a_out_archive[a_out_key] = (compiler_version,
                                                        open("a.out",
                                                             "rb").read())
                    else:
                        utime = -1.0
                        print "        n/a"
                    utimes.append(utime)
                    sys.stdout.flush()
        all_utimes.append(utimes)