Пример #1
0
    chdir('llvm')
    configure = Command('./configure')
    llvm_cfg = ['--enable-assertions', '--enable-optimized']
    if minimal:
        llvm_cfg = llvm_cfg + ['--enable-targets=host,ptx,x86_64,arm']
    else:
        llvm_cfg = llvm_cfg + [
            '--enable-targets=all', '--enable-docs', '--enable-doxygen'
        ]
    status('''Configuring llvm:
    %s''' % llvm_cfg)
    print configure(llvm_cfg)

    status('Building llvm')
    # print make('-j', '--load-average=%f' % max_load)
    print make('-j12')

    chdir('docs')
    if not minimal:
        make('ocamldoc', '-j', '--load-average=%f' % max_load)
    # optional: check_call('make doxygen'.split(' '))
    chdir('../..')
    assert check_llvm()

# Test building
chdir('src')
status('Test: building halide.cmxa')
print ocamlbuild('-use-ocamlfind', 'halide.cmxa')
chdir('..')

status('Building C++ bindings')
Пример #2
0
def test_cpp(name):
    
    global failures
    
    # status(name, "Building libHalide.a")
    # Make sure Halide.a is built
    make('-C', '../cpp_bindings/', 'libHalide.a')

    curdir = os.getcwd()

    # Dive in
    os.chdir(name)

    srcfile = "test.cpp"
    logfile = "log.txt"
    errfile = "err.txt"
    
    # Clean up old stuff
    remove("generated.o")
    remove("generated.bc")
    remove("passes.txt")
    remove("a.out")
    remove(logfile)
    remove(errfile)
    
    # Threading these through as file handles shared by all PBS tasks makes
    # sure each task appends to the main logs, and flushes on exception.
    with open(logfile, "wt") as log:
        with open(errfile, "wt") as err:
            # status(name, "Compiling %s" % srcfile)
            compile_cmd = ["-I../../../cpp_bindings",
                           "-Wno-format",
                           "-fPIC",
                           srcfile]
            if platform in ['linux', 'darwin']:
                compile_cmd.append("../../../cpp_bindings/libHalide.a")
            compile_cmd.extend(["-ldl", "-lpthread"])
            if platform is 'linux':
                compile_cmd.append("-rdynamic")

            if os.path.exists("/usr/local/cuda"):
                compile_cmd.extend(["-L/usr/local/cuda/lib", "-lcuda"])
                if platform is 'linux':
                    compile_cmd.append("-L/usr/lib/nvidia-current")
            
            try:
                # Build the test
                # status(name, " ".join(compile_cmd))
                if platform is 'cygwin':
                    objfile = srcfile[:-srcfile[::-1].find('.')] + "o"
                    compile_cmd.append("-c")
                    compile_cmd.append("-o "+objfile)
                    cxx(compile_cmd, _out=log, _err=err)
                    flexlink = Command("flexlink")
                    link_cmd = ["../../../cpp_bindings/libHalide.a",
                                objfile,
                                "-chain cygwin",
                                "-exe",
                                "-lstdc++",
                                "-o a.out",
								"--",
								"-export-all-symbols"] 
                    flexlink(link_cmd, _out=log, _err=err)
                else:
				    cxx(compile_cmd, _out=log, _err=err)
                # Run the test
                # status(name, "Running test")
                tester = Command("./a.out")
                tester(_out=log, _err=err)
                sys.stdout.write(".")
                sys.stdout.flush()
            except:
                sys.stdout.write("E")
                sys.stdout.flush()
                failures.append(name)

    # Pop back up
    os.chdir(curdir)
Пример #3
0
    configure = Command("./configure")
    llvm_cfg = ["--enable-assertions", "--enable-optimized"]
    if minimal:
        llvm_cfg = llvm_cfg + ["--enable-targets=host,ptx,x86_64,arm"]
    else:
        llvm_cfg = llvm_cfg + ["--enable-targets=all", "--enable-docs", "--enable-doxygen"]
    status(
        """Configuring llvm:
    %s"""
        % llvm_cfg
    )
    print configure(llvm_cfg)

    status("Building llvm")
    # print make('-j', '--load-average=%f' % max_load)
    print make("-j12")

    chdir("docs")
    if not minimal:
        make("ocamldoc", "-j", "--load-average=%f" % max_load)
    # optional: check_call('make doxygen'.split(' '))
    chdir("../..")
    assert check_llvm()

# Test building
chdir("src")
status("Test: building halide.cmxa")
print ocamlbuild("-use-ocamlfind", "halide.cmxa")
chdir("..")

status("Building C++ bindings")