Beispiel #1
0
def get_branch(wd=pyct.SOURCE_DIRECTORY):
    cmd = pyct.command(["git", "show", "-s", "--pretty=%d", "HEAD"])
    cmd.SetOutputStripTrailingWhitespace(True)
    cmd.SetWorkingDirectory(wd)
    cmd.Execute()
    branch = cmd.Output()
    branch = branch.split(" ")
    if branch:
        branch = branch[len(branch) - 1]
        branch = branch.strip(")")
    if not branch:
        branch = pyct.GetGitBranch(wd)
    return branch
Beispiel #2
0
def run_pyctest():
    '''
    Configure PyCTest and execute
    '''
    # run argparse, checkout source, copy over files
    args = configure()

    # shorthand directories
    source_dir = pyctest.SOURCE_DIRECTORY

    # executables
    pyexe = pyctest.PYTHON_EXECUTABLE
    pycoverage = find_python_coverage()
    gcovcommand = helpers.FindExePath("gcov")
    if gcovcommand is None:
        args.coverage = False

    # properties
    bench_props = {
        "WORKING_DIRECTORY" : pyctest.SOURCE_DIRECTORY,
        "DEPENDS" : "nosetests",
        "TIMEOUT" : "10800"
    }

    #   CTEST_TOKEN
    find_ctest_token()

    #   BUILD_NAME
    pyctest.BUILD_NAME = "[{}]".format(pyctest.GetGitBranch(source_dir))
    build_name_append(platform.uname()[0], separate=False, suffix="")
    build_name_append(helpers.GetSystemVersionInfo(), prefix="(", suffix=")")
    build_name_append(platform.uname()[4], separate=False, prefix="")
    build_name_append(platform.python_version(), prefix="[Python ")
    build_name_append(args.sanitizer_type.lower(), check=args.enable_sanitizer)
    build_name_append("PTL", check=args.enable_tasking)
    build_name_append(args.customize_build_name)
    build_name_append("coverage", check=args.coverage)


    #   BUILD_COMMAND
    pyctest.BUILD_COMMAND = "{} setup.py --hide-listing -q install".format(pyexe)
    pyctest.BUILD_COMMAND += " --build-type=Debug" if args.coverage else ""
    pyctest.BUILD_COMMAND += " -- {}".format(" ".join(args.cmake_args))

    build_option_append(args.enable_sanitizer, "TOMOPY_USE_SANITIZER", "ON")
    build_option_append(args.enable_sanitizer, "SANITIZER_TYPE", args.sanitizer_type)
    build_option_append(args.coverage, "TOMOPY_USE_COVERAGE", "ON")

    print("TomoPy BUILD_COMMAND: '{}'...".format(pyctest.BUILD_COMMAND))

    #   COVERAGE_COMMAND
    pyctest.COVERAGE_COMMAND = "{};xml".format(pycoverage)
    if args.coverage:
        pyctest.COVERAGE_COMMAND = "{}".format(gcovcommand)
        pyctest.set("CTEST_COVERAGE_EXTRA_FLAGS", "-m")
        pyctest.set("CTEST_EXTRA_COVERAGE_GLOB", "{}/*.gcno".format(source_dir))

    # unit tests
    create_correct_module_test()
    create_nosetest_test(args)
    create_coverage_test(args)

    # globus tests
    for phantom in args.globus_phantoms:
        for algorithm in args.algorithms:
            create_globus_test(args, bench_props, algorithm, phantom)

    # phantom tests
    for phantom in args.phantoms:
        create_phantom_test(args, bench_props, phantom)

    print('Running PyCTest:\n\n\t{}\n\n'.format(pyctest.BUILD_NAME))

    pyctest.run()
Beispiel #3
0
def run_pyctest():
    # run argparse, checkout source, copy over files
    args = configure()
    # Change the build name to somthing other than default
    pyctest.BUILD_NAME = "[{}] [{} {} {}] [Python ({}) {}]".format(
        pyctest.GetGitBranch(pyctest.SOURCE_DIRECTORY),
        platform.uname()[0],
        helpers.GetSystemVersionInfo(),
        platform.uname()[4],
        platform.python_implementation(),
        platform.python_version())
    # when coverage is enabled, we compile in debug so modify the build name
    # so that the history of test timing is not affected
    if args.coverage:
        pyctest.BUILD_NAME = "{} [coverage]".format(pyctest.BUILD_NAME)
    # remove any consecutive spaces
    while "  " in pyctest.BUILD_NAME:
        pyctest.BUILD_NAME = pyctest.BUILD_NAME.replace("  ", " ")
    # how to build the code
    pyctest.BUILD_COMMAND = "{} setup.py install".format(
        pyctest.PYTHON_EXECUTABLE)
    # generate the code coverage
    python_path = os.path.dirname(pyctest.PYTHON_EXECUTABLE)
    cover_exe = helpers.FindExePath("coverage", path=python_path)
    if args.coverage:
        gcov_cmd = helpers.FindExePath("gcov")
        if gcov_cmd is not None:
            pyctest.COVERAGE_COMMAND = "{}".format(gcov_cmd)
            pyctest.set("CTEST_COVERAGE_EXTRA_FLAGS", "-m")
            pyctest.set("CTEST_EXTRA_COVERAGE_GLOB", "{}/*.gcno".format(
                pyctest.SOURCE_DIRECTORY))
    else:
        # assign to just generate python coverage
        pyctest.COVERAGE_COMMAND = "{};xml".format(cover_exe)
    # copy over files from os.getcwd() to pyctest.BINARY_DIR
    # (implicitly copies over PyCTest{Pre,Post}Init.cmake if they exist)
    copy_files = [os.path.join("benchmarking", "pyctest_tomopy_utils.py"),
                  os.path.join("benchmarking", "pyctest_tomopy_phantom.py"),
                  os.path.join("benchmarking", "pyctest_tomopy_rec.py")]
    pyctest.copy_files(copy_files)
    # find the CTEST_TOKEN_FILE
    home = helpers.GetHomePath()
    if home is not None:
        token_path = os.path.join(home, ".tokens", "nersc-tomopy")
        if os.path.exists(token_path):
            pyctest.set("CTEST_TOKEN_FILE", token_path)
    # create a CTest that checks we imported the correct module
    test = pyctest.test()
    test.SetName("correct_module")
    test.SetCommand([pyctest.PYTHON_EXECUTABLE, "-c",
                     "\"import os, sys, tomopy; " +
                     "print('using tomopy module: {}'.format(tomopy.__file__)); " +
                     "ret=0 if os.getcwd() in tomopy.__file__ else 1; " +
                     "sys.exit(ret)\""])
    # set directory to run test
    test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
    test.SetProperty("ENVIRONMENT", "OMP_NUM_THREADS=1")
    # create a CTest that wraps "nosetest"
    test = pyctest.test()
    test.SetName("nosetests")
    nosetest_exe = helpers.FindExePath("nosetests", path=python_path)
    if nosetest_exe is None:
        nosetest_exe = helpers.FindExePath("nosetests")
    coverage_exe = helpers.FindExePath("coverage", path=python_path)
    if coverage_exe is None:
        coverage_exe = helpers.FindExePath("coverage")
    # python $(which coverage) run $(which nosetests)
    test.SetCommand([pyctest.PYTHON_EXECUTABLE, coverage_exe, "run",
                    nosetest_exe])
    # set directory to run test
    test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
    test.SetProperty("ENVIRONMENT", "OMP_NUM_THREADS=1")
    # Generating C code coverage is enabled
    if args.coverage:
        # if generating C code coverage, generating the Python coverage
        # needs to be put inside a test (that runs after nosetest)
        # because pyctest.COVERAGE_COMMAND is used to generate GCov files
        coverage_cmd = ""
        if platform.system() != "Windows":
            cover_cmd = os.path.join(pyctest.SOURCE_DIRECTORY,
                                     "benchmarking", "generate_coverage.sh")
            coverage_cmd = [cover_cmd, pyctest.SOURCE_DIRECTORY]
        else:
            # don't attempt GCov on Windows
            cover_cmd = helpers.FindExePath("coverage", path=python_path)
            coverage_cmd = [cover_cmd, "xml"]
        test = pyctest.test()
        test.SetName("python_coverage")
        test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
        test.SetProperty("DEPENDS", "nosetests")
        test.SetCommand(coverage_cmd)
    # If path to globus is provided, skip when generating C coverage (too long)
    if not args.coverage and args.globus_path is not None:
        phantom = "tomo_00001"
        h5file = os.path.join(args.globus_path, phantom, phantom + ".h5")
        if not os.path.exists(h5file):
            print("Warning! HDF5 file '{}' does not exists! "
                  "Skipping test...".format(h5file))
            h5file = None
        # loop over args.algorithms and create tests for each
        for algorithm in args.algorithms:
            test = pyctest.test()
            name = "{}_{}".format(phantom, algorithm)
            # original number of iterations before num-iter added to test name
            if args.num_iter != 10:
                name = "{}_itr{}".format(name, args.num_iter)
            test.SetName(name)
            test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
            test.SetProperty("TIMEOUT", "7200")  # 2 hour
            test.SetProperty("ENVIRONMENT", "OMP_NUM_THREADS=1")
            if h5file is None:
                test.SetCommand([pyctest.PYTHON_EXECUTABLE,
                                "-c",
                                "print(\"Path to Globus file '{}/{}.h5' not specified\")".format(
                                    phantom, phantom)])

            else:
                test.SetCommand([pyctest.PYTHON_EXECUTABLE,
                                ".//benchmarking/pyctest_tomopy_rec.py",
                                h5file,
                                "-a", algorithm,
                                "--type", "slice",
                                "-f", "jpeg",
                                "-S", "1",
                                "-c", "4",
                                "-o", "benchmarking/{}".format(name),
                                "-n", "{}".format(args.ncores),
                                "-i", "{}".format(args.num_iter)])
    # loop over args.phantoms, skip when generating C coverage (too long)
    if not args.coverage and not args.disable_phantom_tests:
        for phantom in args.phantoms:
            # create a test comparing all the args.algorithms
            test = pyctest.test()
            name = "{}_{}".format(phantom, "comparison")

            nsize = 512 if phantom != "shepp3d" else 128
            # if size customized, create unique test-name
            if args.phantom_size is not None and args.phantom_size != 512:
                nsize = (args.phantom_size if phantom != "shepp3d" else
                         int(args.phantom_size / 4))
                name = "{}_pix{}".format(name, nsize)
            # original number of iterations before num-iter added to test name
            if args.num_iter != 10:
                name = "{}_itr{}".format(name, args.num_iter)

            test.SetName(name)
            test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
            test.SetProperty("ENVIRONMENT", "OMP_NUM_THREADS=1")
            test.SetProperty("TIMEOUT", "10800")  # 3 hours
            ncores = args.ncores
            niters = args.num_iter
            if phantom == "shepp3d":
                test.SetProperty("RUN_SERIAL", "ON")
            test.SetCommand([pyctest.PYTHON_EXECUTABLE,
                            "./benchmarking/pyctest_tomopy_phantom.py",
                            "-p", phantom,
                            "-s", "{}".format(nsize),
                            "-A", "360",
                            "-f", "jpeg",
                            "-S", "1",
                            "-n", "{}".format(ncores),
                            "-i", "{}".format(niters),
                            "--output-dir", "benchmarking/{}".format(name),
                            "--compare"] + args.algorithms)
    # generate the CTestConfig.cmake and CTestCustom.cmake
    pyctest.generate_config(pyctest.BINARY_DIRECTORY)
    # generate the CTestTestfile.cmake file
    pyctest.generate_test_file(pyctest.BINARY_DIRECTORY)
    # run CTest
    pyctest.run(pyctest.ARGUMENTS, pyctest.BINARY_DIRECTORY)
Beispiel #4
0
def run_pyctest():

    # ----------------------------------------------------------------------- #
    # run argparse, checkout source, copy over files
    #
    args = configure()

    # ----------------------------------------------------------------------- #
    # Compiler version
    #
    if os.environ.get("CXX") is None:
        os.environ["CXX"] = os.path.realpath(helpers.FindExePath("c++"))
    cmd = pyct.command([os.environ["CXX"], "-dumpversion"])
    cmd.SetOutputStripTrailingWhitespace(True)
    cmd.Execute()
    compiler_version = cmd.Output()

    # ----------------------------------------------------------------------- #
    # Set the build name
    #
    pyct.BUILD_NAME = "[{}] [{} {} {}] [{} {}]".format(
        pyct.GetGitBranch(pyct.SOURCE_DIRECTORY),
        platform.uname()[0],
        helpers.GetSystemVersionInfo(),
        platform.uname()[4],
        os.path.basename(os.environ["CXX"]),
        compiler_version,
    )

    # ----------------------------------------------------------------------- #
    #   build specifications
    #
    build_opts = {
        "PTL_USE_ARCH": "OFF",
        "PTL_USE_TBB": "OFF",
        "PTL_USE_SANITIZER": "OFF",
        "PTL_USE_CLANG_TIDY": "OFF",
        "PTL_USE_COVERAGE": "OFF",
        "PTL_USE_LOCKS": "ON" if args.use_locks else "OFF",
    }

    if args.tbb:
        pyct.BUILD_NAME = "{} [tbb]".format(pyct.BUILD_NAME)
        build_opts["PTL_USE_TBB"] = "ON"
    if args.arch:
        pyct.BUILD_NAME = "{} [arch]".format(pyct.BUILD_NAME)
        build_opts["PTL_USE_ARCH"] = "ON"
    if args.sanitizer:
        pyct.BUILD_NAME = "{} [{}]".format(pyct.BUILD_NAME, args.sanitizer_type)
        build_opts["PTL_USE_SANITIZER"] = "ON"
        build_opts["PTL_SANITIZER_TYPE"] = args.sanitizer_type
    if args.static_analysis:
        build_opts["PTL_USE_CLANG_TIDY"] = "ON"
    if args.coverage:
        gcov_exe = helpers.FindExePath("gcov")
        if gcov_exe is not None:
            pyct.COVERAGE_COMMAND = "{}".format(gcov_exe)
            build_opts["PTL_USE_COVERAGE"] = "ON"
            warnings.warn("Forcing build type to 'Debug' when coverage is enabled")
            pyct.BUILD_TYPE = "Debug"
    build_opts["BUILD_SHARED_LIBS"] = "ON" if "shared" in args.build_libs else "OFF"
    build_opts["BUILD_STATIC_LIBS"] = "ON" if "static" in args.build_libs else "OFF"
    pyct.BUILD_NAME = "{} [{}]".format(pyct.BUILD_NAME, pyct.BUILD_TYPE)

    # default options
    cmake_args = "-DCMAKE_BUILD_TYPE={} -DPTL_BUILD_EXAMPLES=ON".format(pyct.BUILD_TYPE)

    # customized from args
    for key, val in build_opts.items():
        cmake_args = "{} -D{}={}".format(cmake_args, key, val)

    # ----------------------------------------------------------------------- #
    # how to build the code
    #
    ctest_cmake_cmd = "${CTEST_CMAKE_COMMAND}"
    pyct.CONFIGURE_COMMAND = "{} {} {} {}".format(
        ctest_cmake_cmd, cmake_args, " ".join(pycm.ARGUMENTS), pyct.SOURCE_DIRECTORY
    )

    # ----------------------------------------------------------------------- #
    # how to build the code
    #
    pyct.BUILD_COMMAND = "{} --build {} --target all".format(
        ctest_cmake_cmd, pyct.BINARY_DIRECTORY
    )

    # ----------------------------------------------------------------------- #
    # parallel build
    #
    if not args.static_analysis:
        if platform.system() != "Windows":
            pyct.BUILD_COMMAND = "{} -- -j{} VERBOSE=1".format(
                pyct.BUILD_COMMAND, mp.cpu_count()
            )
        else:
            pyct.BUILD_COMMAND = "{} -- /MP -A x64".format(pyct.BUILD_COMMAND)

    # ----------------------------------------------------------------------- #
    # how to update the code
    #
    git_exe = helpers.FindExePath("git")
    pyct.UPDATE_COMMAND = "{}".format(git_exe)
    pyct.set("CTEST_UPDATE_TYPE", "git")
    pyct.set("CTEST_GIT_COMMAND", "{}".format(git_exe))

    # ----------------------------------------------------------------------- #
    # static analysis
    #
    clang_tidy_exe = helpers.FindExePath("clang-tidy")
    if clang_tidy_exe:
        pyct.set("CMAKE_CXX_CLANG_TIDY", "{};-checks=*".format(clang_tidy_exe))

    # ----------------------------------------------------------------------- #
    # find the CTEST_TOKEN_FILE
    #
    if args.pyctest_token_file is None and args.pyctest_token is None:
        home = helpers.GetHomePath()
        if home is not None:
            token_path = os.path.join(home, os.path.join(".tokens", "nersc-cdash"))
            if os.path.exists(token_path):
                pyct.set("CTEST_TOKEN_FILE", token_path)

    # ----------------------------------------------------------------------- #
    # construct a command
    #
    def construct_command(cmd, args):
        _cmd = []
        _cmd.extend(cmd)
        return _cmd

    # ----------------------------------------------------------------------- #
    # standard environment settings for tests, adds profile to notes
    #
    def test_env_settings(prof_fname, clobber=False, extra=""):
        return "PTL_NUM_THREADS={};CPUPROFILE={};{}".format(
            mp.cpu_count(), prof_fname, extra
        )

    # pyct.set("ENV{GCOV_PREFIX}", pyct.BINARY_DIRECTORY)
    # pyct.set("ENV{GCOV_PREFIX_STRIP}", "4")

    # ----------------------------------------------------------------------- #
    # create tests
    #
    tasking_suffix = ""
    if args.num_tasks != 65536:
        tasking_suffix = "_{}".format(args.num_tasks)
    test = pyct.test()
    test.SetName("tasking{}".format(tasking_suffix))
    test.SetProperty("WORKING_DIRECTORY", pyct.BINARY_DIRECTORY)
    test.SetProperty(
        "ENVIRONMENT",
        test_env_settings(
            "cpu-prof-tasking",
            clobber=True,
            extra="NUM_TASKS={}".format(args.num_tasks),
        ),
    )
    test.SetProperty("RUN_SERIAL", "ON")
    test.SetCommand(construct_command(["./tasking"], args))

    test = pyct.test()
    test.SetName("recursive_tasking")
    test.SetProperty("WORKING_DIRECTORY", pyct.BINARY_DIRECTORY)
    test.SetProperty("ENVIRONMENT", test_env_settings("cpu-prof-recursive-tasking"))
    test.SetProperty("RUN_SERIAL", "ON")
    test.SetCommand(construct_command(["./recursive_tasking"], args))

    test = pyct.test()
    test.SetName("minimal")
    test.SetProperty("WORKING_DIRECTORY", pyct.BINARY_DIRECTORY)
    test.SetProperty("RUN_SERIAL", "ON")
    test.SetCommand(construct_command(["./ptl-minimal"], args))

    if args.tbb:
        test = pyct.test()
        test.SetName("tbb_minimal")
        test.SetProperty("WORKING_DIRECTORY", pyct.BINARY_DIRECTORY)
        test.SetProperty("RUN_SERIAL", "ON")
        test.SetProperty("ENVIRONMENT", "PTL_USE_TBB=ON")
        test.SetCommand(construct_command(["./ptl-minimal"], args))

        test = pyct.test()
        test.SetName("tbb_tasking{}".format(tasking_suffix))
        test.SetProperty("WORKING_DIRECTORY", pyct.BINARY_DIRECTORY)
        test.SetProperty(
            "ENVIRONMENT",
            test_env_settings(
                "cpu-prof-tbb-tasking",
                extra="NUM_TASKS={}".format(args.num_tasks),
            ),
        )
        test.SetProperty("RUN_SERIAL", "ON")
        test.SetCommand(construct_command(["./tbb_tasking"], args))

        test = pyct.test()
        test.SetName("recursive_tbb_tasking")
        test.SetProperty("WORKING_DIRECTORY", pyct.BINARY_DIRECTORY)
        test.SetProperty(
            "ENVIRONMENT", test_env_settings("cpu-prof-tbb-recursive-tasking")
        )
        test.SetProperty("RUN_SERIAL", "ON")
        test.SetCommand(construct_command(["./recursive_tbb_tasking"], args))

    pyct.generate_config(pyct.BINARY_DIRECTORY)
    pyct.generate_test_file(pyct.BINARY_DIRECTORY)
    pyct.run(pyct.ARGUMENTS, pyct.BINARY_DIRECTORY)
Beispiel #5
0
def run_pyctest():

    #--------------------------------------------------------------------------#
    # run argparse, checkout source, copy over files
    #
    args = configure()

    #--------------------------------------------------------------------------#
    # Compiler version
    #
    if os.environ.get("CXX") is None:
        os.environ["CXX"] = helpers.FindExePath("c++")
    cmd = pyctest.command([os.environ["CXX"], "-dumpversion"])
    cmd.SetOutputStripTrailingWhitespace(True)
    cmd.Execute()
    compiler_version = cmd.Output()

    #--------------------------------------------------------------------------#
    # Set the build name
    #
    pyctest.BUILD_NAME = "{} {} {} {} {} {}".format(
        pyctest.GetGitBranch(pyctest.SOURCE_DIRECTORY),
        platform.uname()[0], helpers.GetSystemVersionInfo(),
        platform.uname()[4],
        os.path.basename(os.path.realpath(os.environ["CXX"])),
        compiler_version)
    pyctest.BUILD_NAME = '-'.join(pyctest.BUILD_NAME.split())

    #--------------------------------------------------------------------------#
    #   build specifications
    #
    build_opts = {
        "GEANT_USE_ARCH": "OFF",
        "GEANT_USE_GPERF": "OFF",
        "GEANT_USE_SANITIZER": "OFF",
        "GEANT_USE_CLANG_TIDY": "OFF",
        "GEANT_USE_COVERAGE": "OFF",
        "PTL_USE_TBB": "OFF",
        "GEANT_BUILD_EXAMPLES": "ON",
        "GEANT_BUILD_TESTS": "ON",
        "PTL_BUILD_EXAMPLES": "ON"
    }

    if args.tbb:
        pyctest.BUILD_NAME = "{} tbb".format(pyctest.BUILD_NAME)
        build_opts["PTL_USE_TBB"] = "ON"
    if args.arch:
        pyctest.BUILD_NAME = "{} arch".format(pyctest.BUILD_NAME)
        build_opts["GEANT_USE_ARCH"] = "ON"
    if args.gperf:
        pyctest.BUILD_NAME = "{} gperf".format(pyctest.BUILD_NAME)
        build_opts["GEANT_USE_GPERF"] = "ON"
        warnings.warn(
            "Forcing build type to 'RelWithDebInfo' when gperf is enabled")
        pyctest.BUILD_TYPE = "RelWithDebInfo"
    if args.sanitizer:
        pyctest.BUILD_NAME = "{} asan".format(pyctest.BUILD_NAME)
        build_opts["GEANT_USE_SANITIZER"] = "ON"
    if args.no_static_analysis:
        build_opts["GEANT_USE_CLANG_TIDY"] = "OFF"
    if args.coverage:
        gcov_exe = helpers.FindExePath("gcov")
        if gcov_exe is not None:
            pyctest.COVERAGE_COMMAND = "{}".format(gcov_exe)
            build_opts["GEANT_USE_COVERAGE"] = "ON"
            warnings.warn(
                "Forcing build type to 'Debug' when coverage is enabled")
            pyctest.BUILD_TYPE = "Debug"

    # split and join with dashes
    pyctest.BUILD_NAME = '-'.join(pyctest.BUILD_NAME.replace('/', '-').split())

    # default options
    cmake_args = "-DCMAKE_BUILD_TYPE={} -DPTL_BUILD_EXAMPLES=ON".format(
        pyctest.BUILD_TYPE)

    # customized from args
    for key, val in build_opts.items():
        cmake_args = "{} -D{}={}".format(cmake_args, key, val)

    #--------------------------------------------------------------------------#
    # how to build the code
    #
    ctest_cmake_cmd = "${CTEST_CMAKE_COMMAND}"
    pyctest.CONFIGURE_COMMAND = "{} {} {}".format(ctest_cmake_cmd, cmake_args,
                                                  pyctest.SOURCE_DIRECTORY)

    #--------------------------------------------------------------------------#
    # how to build the code
    #
    pyctest.BUILD_COMMAND = "{} --build {} --target all".format(
        ctest_cmake_cmd, pyctest.BINARY_DIRECTORY)

    #--------------------------------------------------------------------------#
    # parallel build
    #
    if platform.system() != "Windows":
        pyctest.BUILD_COMMAND = "{} -- -j{} VERBOSE=1".format(
            pyctest.BUILD_COMMAND, mp.cpu_count())
    else:
        pyctest.BUILD_COMMAND = "{} -- /MP -A x64".format(
            pyctest.BUILD_COMMAND)

    #--------------------------------------------------------------------------#
    # how to update the code
    #
    git_exe = helpers.FindExePath("git")
    pyctest.UPDATE_COMMAND = "{}".format(git_exe)
    pyctest.set("CTEST_UPDATE_TYPE", "git")
    pyctest.set("CTEST_GIT_COMMAND", "{}".format(git_exe))

    #--------------------------------------------------------------------------#
    # find the CTEST_TOKEN_FILE
    #
    if args.pyctest_token_file is None and args.pyctest_token is None:
        home = helpers.GetHomePath()
        if home is not None:
            token_path = os.path.join(home,
                                      os.path.join(".tokens", "nersc-cdash"))
            if os.path.exists(token_path):
                pyctest.set("CTEST_TOKEN_FILE", token_path)

    #--------------------------------------------------------------------------#
    # construct a command
    #
    def construct_command(cmd, args, clobber=False):
        _cmd = []
        if args.gperf:
            _cmd.append(
                os.path.join(pyctest.BINARY_DIRECTORY, "gperf-cpu-profile.sh"))
            pyctest.add_note(pyctest.BINARY_DIRECTORY,
                             "gperf.cpu.prof.{}.0.txt".format(
                                 os.path.basename(cmd[0])),
                             clobber=clobber)
            pyctest.add_note(pyctest.BINARY_DIRECTORY,
                             "gperf.cpu.prof.{}.0.cum.txt".format(
                                 os.path.basename(cmd[0])),
                             clobber=False)
        #else:
        #    _cmd.append("./timem")
        _cmd.extend(cmd)
        return _cmd

    #--------------------------------------------------------------------------#
    # standard environment settings for tests, adds profile to notes
    #
    def test_env_settings(prof_fname, clobber=False, extra=""):
        return "PTL_NUM_THREADS={};{}".format(mp.cpu_count(), extra)

    #--------------------------------------------------------------------------#
    # create tests
    #
    pyctest.test(
        "test_tuple", construct_command(["./test_tuple"], args, clobber=True),
        {
            "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
            "LABELS": pyctest.PROJECT_NAME
        })
    pyctest.test(
        "test_memory", construct_command(["./test_memory"], args), {
            "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
            "LABELS": pyctest.PROJECT_NAME
        })
    pyctest.test(
        "bench_tuple", construct_command(["./bench_tuple"], args), {
            "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
            "LABELS": pyctest.PROJECT_NAME
        })
    pyctest.test(
        "bench_nvstd", construct_command(["./bench_nvstd"], args), {
            "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
            "LABELS": pyctest.PROJECT_NAME
        })
    pyctest.test(
        "track_manager_tuple",
        construct_command(["./track_manager_tuple"], args), {
            "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
            "LABELS": pyctest.PROJECT_NAME
        })

    tasking_suffix = ""
    if args.num_tasks != 16384:
        tasking_suffix = "_{}".format(args.num_tasks)
    test = pyctest.test()
    test.SetName("tasking{}".format(tasking_suffix))
    test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
    test.SetProperty(
        "ENVIRONMENT",
        test_env_settings("cpu-prof-tasking",
                          clobber=True,
                          extra="NUM_TASKS={}".format(args.num_tasks)))
    test.SetProperty("RUN_SERIAL", "ON")
    test.SetProperty("LABELS", "PTL")
    test.SetCommand(construct_command(["./tasking"], args))

    test = pyctest.test()
    test.SetName("recursive_tasking")
    test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
    test.SetProperty("ENVIRONMENT",
                     test_env_settings("cpu-prof-recursive-tasking"))
    test.SetProperty("RUN_SERIAL", "ON")
    test.SetProperty("LABELS", "PTL")
    test.SetCommand(construct_command(["./recursive_tasking"], args))

    if args.tbb:
        test = pyctest.test()
        test.SetName("tbb_tasking{}".format(tasking_suffix))
        test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
        test.SetProperty(
            "ENVIRONMENT",
            test_env_settings("cpu-prof-tbb-tasking",
                              extra="NUM_TASKS={}".format(args.num_tasks)))
        test.SetProperty("RUN_SERIAL", "ON")
        test.SetProperty("LABELS", "PTL")
        test.SetCommand(construct_command(["./tbb_tasking"], args))

        test = pyctest.test()
        test.SetName("recursive_tbb_tasking")
        test.SetProperty("WORKING_DIRECTORY", pyctest.BINARY_DIRECTORY)
        test.SetProperty("ENVIRONMENT",
                         test_env_settings("cpu-prof-tbb-recursive-tasking"))
        test.SetProperty("RUN_SERIAL", "ON")
        test.SetProperty("LABELS", "PTL")
        test.SetCommand(construct_command(["./recursive_tbb_tasking"], args))

    # generate the dynamic tests
    pyctest.generate_config(pyctest.BINARY_DIRECTORY)
    pyctest.generate_test_file(
        os.path.join(pyctest.BINARY_DIRECTORY, "testing"))
    pyctest.run(pyctest.ARGUMENTS, pyctest.BINARY_DIRECTORY)