Beispiel #1
0
def run_pyctest():

    cwd = os.getcwd()
    # process standard arguments
    helpers.ArgumentParser("PyCTest", cwd, cwd, vcs_type="git",
                           build_type="MinSizeRel").parse_args()
    # base web address of dashboard
    pyctest.DROP_SITE = "cdash.nersc.gov"
    # custom setup.py command (runs CMake)
    pyctest.CONFIGURE_COMMAND = "python setup.py configure"
    # build and install
    pyctest.BUILD_COMMAND = "python setup.py install"
    # basic example test
    examples_dir = os.path.join(pyctest.SOURCE_DIRECTORY, "examples")
    basic_dir = os.path.join(examples_dir, "Basic")
    pyctest.test(name="basic", cmd=["python", "basic.py", "--", "-VV"],
                 properties={"WORKING_DIRECTORY": basic_dir})
    # tomopy example test
    tomopy_dir = os.path.join(examples_dir, "TomoPy")
    pyctest.test(name="tomopy", cmd=["python", "pyctest_tomopy.py",
                                     "--pyctest-stages", "Start",
                                     "Configure", "Build", "--", "-VV"],
                 properties={"WORKING_DIRECTORY": tomopy_dir})
    # run stages
    pyctest.run()
Beispiel #2
0
def parse_args(cl_args=None):
    parser = argparse.ArgumentParser(
        description=__doc__, formatter_class=argparse.RawTextHelpFormatter
    )

    parser.add_argument(
        "profile", help="A YAML file describing the build and test profile to run"
    )

    parser.add_argument("--site", help="Specify the site name", default=None)

    parser.add_argument(
        "-S",
        "--submit",
        help="Submit test results to CDASH",
        action="store_true",
        default=False,
    )

    worker_args = parser.parse_args(cl_args)
    if worker_args.site is None:
        worker_args.site = platform.node()

    with open(worker_args.profile) as stream:
        try:
            yaml = YAML(typ="safe")
            build_profile = yaml.load(stream)
        except YAMLError as e:
            print(e)

    # NOTE: Just use defaults
    pyctest_args = helpers.ArgumentParser(
        "LIVVkit",
        build_profile["source_directory"],
        build_profile["build_directory"],
        drop_site="my.cdash.org",
        drop_method="http",
        site=worker_args.site,
        submit=worker_args.submit,
    ).parse_args(args=[])

    return build_profile, pyctest_args
Beispiel #3
0
def configure():
    # set site if set in environ
    if os.environ.get("CTEST_SITE") is not None:
        pyctest.CTEST_SITE = os.environ.get("CTEST_SITE")

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TomoPy",
                                    source_dir=os.getcwd(),
                                    binary_dir=os.getcwd(),
                                    python_exe=sys.executable,
                                    submit=False,
                                    ctest_args=["-V"])
    # default algorithm choices
    available_algorithms = ['gridrec', 'art', 'fbp', 'bart', 'mlem', 'osem',
                            'sirt', 'ospml_hybrid', 'ospml_quad', 'pml_hybrid',
                            'pml_quad', 'tv', 'grad']
    # default phantom choices
    available_phantoms = ["baboon", "cameraman", "barbara", "checkerboard",
                          "lena", "peppers", "shepp2d", "shepp3d"]
    # choices for algorithms
    algorithm_choices = ['gridrec', 'art', 'fbp', 'bart', 'mlem', 'osem',
                         'sirt', 'ospml_hybrid', 'ospml_quad', 'pml_hybrid',
                         'pml_quad', 'tv', 'grad', 'none', 'all']
    # phantom choices
    phantom_choices = ["baboon", "cameraman", "barbara", "checkerboard",
                       "lena", "peppers", "shepp2d", "shepp3d", "none", "all"]
    # number of cores
    default_ncores = mp.cpu_count()
    # default algorithm choices
    default_algorithms = ['gridrec', 'art', 'fbp', 'bart', 'mlem', 'osem',
                          'sirt', 'ospml_hybrid', 'ospml_quad', 'pml_hybrid',
                          'pml_quad', 'tv', 'grad']
    # default phantom choices
    default_phantoms = ["baboon", "cameraman", "barbara", "checkerboard",
                        "lena", "peppers", "shepp2d", "shepp3d"]

    # default globus phantoms
    default_globus_phantoms = ["tomo_00001"]

    parser.add_argument("-n", "--ncores",
                        help="number of cores",
                        type=int,
                        default=default_ncores)
    parser.add_argument("-i", "--num-iter",
                        help="number of iterations",
                        type=int,
                        default=default_nitr)
    parser.add_argument("--phantoms",
                        help="Phantoms to simulate",
                        type=str,
                        nargs='*',
                        choices=phantom_choices,
                        default=default_phantoms)
    parser.add_argument("--exclude-phantoms",
                        help="Phantoms to simulate",
                        type=str,
                        nargs='*',
                        choices=default_phantoms,
                        default=[])
    parser.add_argument("--phantom-size",
                        type=int,
                        help="Size parameter for the phantom reconstructions",
                        default=default_phantom_size)
    parser.add_argument("--algorithms",
                        help="Algorithms to use",
                        type=str,
                        nargs='*',
                        choices=algorithm_choices,
                        default=default_algorithms)
    parser.add_argument("--globus-path",
                        help="Path to tomobank datasets",
                        type=str,
                        default=None)
    parser.add_argument("--globus-phantoms",
                        help="Globus phantom files (without extension)",
                        type=str,
                        default=default_globus_phantoms,
                        nargs='*')
    parser.add_argument("--skip-cleanup",
                        help="Skip cleanup of any old pyctest files",
                        action='store_true',
                        default=False)
    parser.add_argument("--cleanup",
                        help="Cleanup of any old pyctest files and exit",
                        action='store_true',
                        default=False)
    parser.add_argument("--coverage",
                        help="Enable coverage for compiled code",
                        action='store_true',
                        default=False)
    parser.add_argument("--disable-phantom-tests",
                        help="Disable running phantom tests",
                        action='store_true',
                        default=False)
    parser.add_argument("--customize-build-name",
                        help="Customize the build name",
                        type=str,
                        default=None)
    parser.add_argument("--cmake-args",
                        help="CMake arguments passed to build",
                        type=str,
                        default=[])
    parser.add_argument("--cuda-arch", help="CUDA architecture flag",
                        type=int, default=53)

    def add_bool_opt(args, opt, enable_opt, disable_opt):
        if enable_opt and disable_opt:
            msg = """\nWarning! python options for CMake argument '{}' was enabled \
    AND disabled.\nGiving priority to disable...\n""".format(opt)
            warnings.warn(msg)
            enable_opt = False

        if enable_opt:
            args.cmake_args.append("-D{}:BOOL={}".format(opt, "ON"))
        if disable_opt:
            args.cmake_args.append("-D{}:BOOL={}".format(opt, "OFF"))


    def add_option(parser, lc_name, disp_name):
        # enable option
        parser.add_argument("--enable-{}".format(lc_name), action='store_true',
                            help="Explicitly enable {} build".format(disp_name))
        # disable option
        parser.add_argument("--disable-{}".format(lc_name), action='store_true',
                            help="Explicitly disnable {} build".format(disp_name))

    add_option(parser, "cuda", "CUDA")
    add_option(parser, "nvtx", "NVTX (NVIDIA Nsight)")
    add_option(parser, "arch", "Hardware optimized")
    add_option(parser, "avx512", "AVX-512 optimized")
    add_option(parser, "gperf", "gperftools")
    add_option(parser, "timemory", "TiMemory")
    add_option(parser, "sanitizer", "Enable sanitizer (default=leak)")
    add_option(parser, "tasking", "Tasking library (PTL)")

    parser.add_argument("--sanitizer-type", default="leak",
                        help="Set the sanitizer type",
                        type=str, choices=["leak", "thread", "address", "memory"])

    args = parser.parse_args()

    add_bool_opt(args, "TOMOPY_USE_CUDA", args.enable_cuda, args.disable_cuda)
    add_bool_opt(args, "TOMOPY_USE_NVTX", args.enable_nvtx, args.disable_nvtx)
    if args.enable_avx512 and not args.enable_arch:
        args.enable_arch = True
        args.disable_arch = False
    add_bool_opt(args, "TOMOPY_USE_ARCH", args.enable_arch, args.disable_arch)
    add_bool_opt(args, "TOMOPY_USE_AVX512", args.enable_avx512, args.disable_avx512)
    add_bool_opt(args, "TOMOPY_USE_GPERF", args.enable_gperf, args.disable_gperf)
    add_bool_opt(args, "TOMOPY_USE_TIMEMORY", args.enable_timemory, args.disable_timemory)
    add_bool_opt(args, "TOMOPY_USE_SANITIZER",
                 args.enable_sanitizer, args.disable_sanitizer)
    add_bool_opt(args, "TOMOPY_USE_PTL", args.enable_tasking, args.disable_tasking)

    if args.enable_sanitizer:
        args.cmake_args.append("-DSANITIZER_TYPE:STRING={}".format(args.sanitizer_type))

    if args.enable_cuda:
        args.cmake_args.append("-DCUDA_ARCH={}".format(args.cuda_arch))

    if len(args.cmake_args) > 0:
        print("\n\n\tCMake arguments set via command line: {}\n".format(
            args.cmake_args))

    if args.cleanup:
        cleanup(pyctest.BINARY_DIRECTORY)
        sys.exit(0)

    if not args.skip_cleanup:
        cleanup(pyctest.BINARY_DIRECTORY)

    def remove_entry(entry, container):
        if entry in container:
            container.remove(entry)

    def remove_duplicates(container):
        container = list(set(container))

    if "all" in args.algorithms:
        remove_entry("all", args.algorithms)
        args.algorithms.extend(available_algorithms)

    if "all" in args.phantoms:
        remove_entry("all", args.phantoms)
        args.phantoms.extend(available_phantoms)

    if "none" in args.algorithms:
        args.algorithms = []

    if "none" in args.phantoms:
        args.phantoms = []

    for p in args.exclude_phantoms:
        if p in args.phantoms:
            args.phantoms.remove(p)

    remove_duplicates(args.algorithms)
    remove_duplicates(args.phantoms)

    git_exe = helpers.FindExePath("git")
    if git_exe is not None:
        pyctest.UPDATE_COMMAND = "{}".format(git_exe)
        pyctest.set("CTEST_UPDATE_TYPE", "git")

    if args.enable_sanitizer:
        pyctest.set("CTEST_MEMORYCHECK_TYPE", "{}Sanitizer".format(
            args.sanitizer_type.lower().capitalize()))

    return args
Beispiel #4
0
import os, sys, platform
import multiprocessing as mp
import pyctest.pyctest as pyctest
import pyctest.helpers as helpers

directory = "./"

# these are required

pyctest.PROJECT_NAME = "GENRAY"
pyctest.SOURCE_DIRECTORY = directory
pyctest.BINARY_DIRECTORY = directory

args = helpers.ArgumentParser(pyctest.PROJECT_NAME,
                              pyctest.SOURCE_DIRECTORY,
                              pyctest.BINARY_DIRECTORY).parse_args()

pyctest.BUILD_COMMAND = "make -f makefile_gfortran64"

test = pyctest.test()
test.SetName("test-CMod-LH-edge")
test.SetProperty("WORKING_DIRECTORY","00_Genray_Regression_Tests/ci-tests/test-CMod-LH-edge")
test.SetCommand(["../test.sh"])

test = pyctest.test()
test.SetName("test-CMod-LH-edge-id16")
test.SetProperty("WORKING_DIRECTORY","00_Genray_Regression_Tests/ci-tests/test-CMod-LH-edge-id16")
test.SetCommand(["../test.sh"])

test = pyctest.test()
Beispiel #5
0
def configure():
    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TomoPy",
                                    source_dir=os.getcwd(),
                                    binary_dir=os.getcwd(),
                                    python_exe=sys.executable,
                                    submit=False,
                                    ctest_args=["-V"])
    # default algorithm choices
    available_algorithms = ['gridrec', 'art', 'fbp', 'bart', 'mlem', 'osem',
                            'sirt', 'ospml_hybrid', 'ospml_quad', 'pml_hybrid',
                            'pml_quad', 'tv', 'grad']
    # default phantom choices
    available_phantoms = ["baboon", "cameraman", "barbara", "checkerboard",
                          "lena", "peppers", "shepp2d", "shepp3d"]
    # choices for algorithms
    algorithm_choices = ['gridrec', 'art', 'fbp', 'bart', 'mlem', 'osem',
                         'sirt', 'ospml_hybrid', 'ospml_quad', 'pml_hybrid',
                         'pml_quad', 'tv', 'grad', 'none', 'all']
    # phantom choices
    phantom_choices = ["baboon", "cameraman", "barbara", "checkerboard",
                       "lena", "peppers", "shepp2d", "shepp3d", "none", "all"]
    # number of iterations
    default_nitr = 10
    # number of cores
    default_ncores = mp.cpu_count()
    # default algorithm choices
    default_algorithms = ['gridrec', 'art', 'fbp', 'bart', 'mlem', 'osem',
                          'sirt', 'ospml_hybrid', 'ospml_quad', 'pml_hybrid',
                          'pml_quad', 'tv', 'grad']
    # default phantom choices
    default_phantoms = ["baboon", "cameraman", "barbara", "checkerboard",
                        "lena", "peppers", "shepp2d", "shepp3d"]

    parser.add_argument("-n", "--ncores",
                        help="number of cores",
                        type=int,
                        default=default_ncores)
    parser.add_argument("-i", "--num-iter",
                        help="number of iterations",
                        type=int,
                        default=default_nitr)
    parser.add_argument("--phantoms",
                        help="Phantoms to simulate",
                        type=str,
                        nargs='*',
                        choices=phantom_choices,
                        default=default_phantoms)
    parser.add_argument("--phantom-size",
                        type=int,
                        help="Size parameter for the phantom reconstructions",
                        default=None)
    parser.add_argument("--algorithms",
                        help="Algorithms to use",
                        type=str,
                        nargs='*',
                        choices=algorithm_choices,
                        default=default_algorithms)
    parser.add_argument("--globus-path",
                        help="Path to tomobank datasets",
                        type=str,
                        default=None)
    parser.add_argument("--skip-cleanup",
                        help="Skip cleanup of any old pyctest files",
                        action='store_true',
                        default=False)
    parser.add_argument("--cleanup",
                        help="Cleanup of any old pyctest files and exit",
                        action='store_true',
                        default=False)
    parser.add_argument("--coverage",
                        help="Enable coverage for compiled code",
                        action='store_true',
                        default=False)
    parser.add_argument("--disable-phantom-tests",
                        help="Disable running phantom tests",
                        action='store_true',
                        default=False)
    # calls PyCTest.helpers.ArgumentParser.parse_args()
    args = parser.parse_args()

    if args.cleanup:
        cleanup(pyctest.BINARY_DIRECTORY)
        sys.exit(0)

    if not args.skip_cleanup:
        cleanup(pyctest.BINARY_DIRECTORY)

    def remove_entry(entry, container):
        if entry in container:
            container.remove(entry)

    def remove_duplicates(container):
        container = list(set(container))

    if "all" in args.algorithms:
        remove_entry("all", args.algorithms)
        args.algorithms.extend(available_algorithms)

    if "all" in args.phantoms:
        remove_entry("all", args.phantoms)
        args.phantoms.extend(available_phantoms)

    if "none" in args.algorithms:
        args.algorithms = []

    if "none" in args.phantoms:
        args.phantoms = []

    remove_duplicates(args.algorithms)
    remove_duplicates(args.phantoms)

    if args.coverage:
        # read by Makefile.linux and Makefile.darwin
        pyctest.set(
            "ENV{CFLAGS}", "-g -O0 -fprofile-arcs -ftest-coverage")
        pyctest.set("ENV{LDFLAGS}", "-fprofile-arcs -lgcov")

    git_exe = helpers.FindExePath("git")
    if git_exe is not None:
        pyctest.UPDATE_COMMAND = "{}".format(git_exe)
        pyctest.set("CTEST_UPDATE_TYPE", "git")
        pyctest.set("CTEST_UPDATE_VERSION_ONLY", "ON")

    return args
Beispiel #6
0
def configure():

    # set site if set in environ
    if os.environ.get("CTEST_SITE") is not None:
        pyctest.CTEST_SITE = os.environ.get("CTEST_SITE")
    elif os.environ.get("NERSC_HOST") is not None:
        pyctest.CTEST_SITE = os.environ.get("NERSC_HOST")
    elif os.environ.get("HOSTNAME") is not None:
        pyctest.CTEST_SITE = os.environ.get("HOSTNAME")

    # the current directory of this file
    this_dir = os.path.dirname(__file__)

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(
        project_name="gpu-for-science-day-july-2019",
        source_dir=this_dir,
        binary_dir=os.path.join(this_dir, "gpp"),
        drop_site="cdash.nersc.gov",
        drop_method="https",
        submit=True,
        ctest_args=["-V"])
    # compiler choices
    compiler_choices = ["intel", "gcc", "cuda", "openacc", "openmp", "kokkos"]

    parser.add_argument("--compiler",
                        type=str,
                        choices=compiler_choices,
                        required=True,
                        help="Select the compiler")
    parser.add_argument("--team",
                        type=str,
                        required=True,
                        help="Specify the team name")
    parser.add_argument("--cleanup",
                        action='store_true',
                        default=False,
                        help="Cleanup of any old pyctest files and exit")
    parser.add_argument("--type",
                        help="Execute either test or benchmark",
                        type=str,
                        default="benchmark",
                        choices=["benchmark", "test"])
    parser.add_argument("-d",
                        "--test-dir",
                        help="Set the testing directory",
                        default=os.path.join(this_dir, "gpp"),
                        type=str)
    parser.add_argument("--post-cleanup",
                        type=bool,
                        default=True,
                        help="Cleanup pyctest files after execution")

    args = parser.parse_args()

    if args.cleanup:
        cleanup(pyctest.BINARY_DIRECTORY)
        sys.exit(0)

    if os.path.exists(args.test_dir):
        pyctest.BINARY_DIRECTORY = os.path.abspath(args.test_dir)

    git_exe = helpers.FindExePath("git")
    if git_exe is not None:
        pyctest.UPDATE_COMMAND = "{}".format(git_exe)
        pyctest.set("CTEST_UPDATE_TYPE", "git")

    return args
Beispiel #7
0
def configure():

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(
        project_name="PTL",
        source_dir=os.getcwd(),
        binary_dir=os.path.join(os.getcwd(), "build-PTL"),
        build_type="Release",
        vcs_type="git",
    )

    parser.add_argument(
        "--arch", help="PTL_USE_ARCH=ON", default=False, action="store_true"
    )
    parser.add_argument(
        "--tbb", help="PTL_USE_TBB=ON", default=False, action="store_true"
    )
    parser.add_argument(
        "--sanitizer",
        help="PTL_USE_SANITIZER=ON",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "--sanitizer-type",
        help="PTL_SANITIZER_TYPE=<type>",
        default="leak",
        type=str,
        choices=("leak", "thread", "memory", "address"),
    )
    parser.add_argument(
        "--static-analysis",
        help="PTL_USE_CLANG_TIDY=ON",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "--coverage",
        help="PTL_USE_COVERAGE=ON",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "--num-tasks", help="Set the number of tasks", default=65536, type=int
    )
    parser.add_argument(
        "--use-locks",
        help="Enable mutex locking in task subqueues for extra safety",
        default=None,
        action="store_true",
    )
    parser.add_argument(
        "--build-libs",
        help="Set the number of tasks",
        default=["shared", "static"],
        type=str,
        nargs="*",
        choices=("shared", "static"),
    )

    args = parser.parse_args()

    if os.path.exists(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version

        if (
            _pyctest_version[0] == 0
            and _pyctest_version[1] == 0
            and _pyctest_version[2] < 11
        ):
            cmd = pyct.command(
                [cm, "--build", pyct.BINARY_DIRECTORY, "--target", "clean"]
            )
            cmd.SetWorkingDirectory(pyct.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake

            CMake("--build", pyct.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt"))

    pyct.set(
        "CTEST_CUSTOM_COVERAGE_EXCLUDE",
        ";".join(
            [
                "/usr/.*",
                ".*external/.*",
                ".*examples/.*",
                ".*/Backtrace.hh",
            ]
        ),
    )

    return args
Beispiel #8
0
def configure():

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TiMemory",
                                    source_dir=os.getcwd(),
                                    binary_dir=os.path.join(
                                        os.getcwd(), "build-timemory",
                                        platform.system()),
                                    build_type="Release",
                                    vcs_type="git",
                                    use_launchers=False)

    parser.add_argument("--arch",
                        help="TIMEMORY_USE_ARCH=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--profile",
                        help="Run gperf profiler",
                        default=None,
                        type=str,
                        choices=("cpu", "heap"))
    parser.add_argument("--sanitizer",
                        help="Type of sanitizer",
                        default=None,
                        type=str,
                        choices=("leak", "memory", "address", "thread"))
    parser.add_argument("--coverage",
                        help="TIMEMORY_USE_COVERAGE=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--static-analysis",
                        help="TIMEMORY_USE_CLANG_TIDY=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tools",
                        help="TIMEMORY_BUILD_TOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tau",
                        help="TIMEMORY_USE_TAU=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpip",
                        help="TIMEMORY_BUILD_MPIP=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cuda",
                        help="TIMEMORY_USE_CUDA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--nvtx",
                        help="TIMEMORY_USE_NVTX=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cupti",
                        help="TIMEMORY_USE_CUPTI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--upcxx",
                        help="TIMEMORY_USE_UPCXX=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gotcha",
                        help="TIMEMORY_USE_GOTCHA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gperftools",
                        help="TIMEMORY_USE_GPERFTOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--caliper",
                        help="TIMEMORY_USE_CALIPER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--likwid",
                        help="TIMEMORY_USE_LIKWID=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--papi",
                        help="TIMEMORY_USE_PAPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpi",
                        help="TIMEMORY_USE_MPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpi-init",
                        help="TIMEMORY_USE_MPI_INIT=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--python",
                        help="TIMEMORY_BUILD_PYTHON=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--ompt",
                        help="TIMEMORY_BUILD_OMPT=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--kokkos",
                        help="TIMEMORY_BUILD_KOKKOS_TOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--dyninst",
                        help="TIMEMORY_USE_DYNINST=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--extra-optimizations",
                        help="TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--lto",
                        help="TIMEMORY_BUILD_LTO=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--developer",
                        help="TIMEMORY_BUILD_DEVELOPER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--xray",
                        help="TIMEMORY_BUILD_XRAY=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--stats",
                        help="TIMEMORY_USE_STATISTICS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--timing",
                        help="TIMEMORY_USE_COMPILE_TIMING=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--build-libs",
                        help="Build library type(s)",
                        default=("shared"),
                        nargs='*',
                        type=str,
                        choices=("static", "shared"))
    parser.add_argument("--tls-model",
                        help="Thread-local static model",
                        default=('global-dynamic'),
                        type=str,
                        choices=('global-dynamic', 'local-dynamic',
                                 'initial-exec', 'local-exec'))
    parser.add_argument("--cxx-standard",
                        help="C++ standard",
                        type=str,
                        default="17",
                        choices=("14", "17", "20"))
    parser.add_argument("--generate",
                        help="Generate the tests only",
                        action='store_true')
    parser.add_argument("-j",
                        "--cpu-count",
                        type=int,
                        default=mp.cpu_count(),
                        help="Parallel build jobs to run")

    args = parser.parse_args()

    if "shared" not in args.build_libs and args.python:
        raise RuntimeError("Python cannot be built with static libraries")

    if os.environ.get("CTEST_SITE") is not None:
        pyct.set("CTEST_SITE", "{}".format(os.environ.get("CTEST_SITE")))

    if os.path.exists(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version
        if (_pyctest_version[0] == 0 and _pyctest_version[1] == 0
                and _pyctest_version[2] < 11):
            cmd = pyct.command(
                [cm, "--build", pyct.BINARY_DIRECTORY, "--target", "clean"])
            cmd.SetWorkingDirectory(pyct.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake
            CMake("--build", pyct.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(
            os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt"))

    if platform.system() != "Linux":
        args.papi = False

    os.environ["PYCTEST_TESTING"] = "ON"
    os.environ["TIMEMORY_PLOT_OUTPUT"] = "ON"
    os.environ["TIMEMORY_BANNER"] = "OFF"

    # update PYTHONPATH for the unit tests
    pypath = os.environ.get("PYTHONPATH", "").split(":")
    pypath = [pyct.BINARY_DIRECTORY] + pypath
    os.environ["PYTHONPATH"] = ":".join(pypath)

    return args
Beispiel #9
0
import platform
import pyctest.pyctest as pyctest
import pyctest.pycmake as pycmake
import pyctest.helpers as helpers

if __name__ == "__main__":

    directory = os.path.join(os.getcwd(), "pycm-test")

    # these are required
    pyctest.PROJECT_NAME = "PyCTest"
    pyctest.SOURCE_DIRECTORY = os.getcwd()
    pyctest.BINARY_DIRECTORY = directory

    args = helpers.ArgumentParser(pyctest.PROJECT_NAME,
                                  pyctest.SOURCE_DIRECTORY,
                                  pyctest.BINARY_DIRECTORY,
                                  update_command="git").parse_args()

    # set explicitly
    pyctest.MODEL = "Continuous"
    pyctest.SITE = platform.node()

    # create a Test object
    test = pyctest.test()
    test.SetName("list_directory")
    test.SetCommand(["ls", directory])
    test.SetProperty("WORKING_DIRECTORY", os.getcwd())
    test.SetProperty("LABELS", "shutil")

    # create a second test with direct initialization
    pyctest.test("hostname", ["hostname"], {
Beispiel #10
0
def configure():

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TiMemory",
                                    source_dir=os.getcwd(),
                                    binary_dir=os.path.join(
                                        os.getcwd(), "build-timemory",
                                        platform.system()),
                                    build_type="Release",
                                    vcs_type="git",
                                    use_launchers=False)

    parser.add_argument("--arch",
                        help="TIMEMORY_USE_ARCH=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--profile",
                        help="Run gperf profiler",
                        default=None,
                        type=str,
                        choices=("cpu", "heap"))
    parser.add_argument("--sanitizer",
                        help="Type of sanitizer",
                        default=None,
                        type=str,
                        choices=("leak", "memory", "address", "thread"))
    parser.add_argument("--coverage",
                        help="TIMEMORY_USE_COVERAGE=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--static-analysis",
                        help="TIMEMORY_USE_CLANG_TIDY=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tools",
                        help="TIMEMORY_BUILD_TOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tau",
                        help="TIMEMORY_USE_TAU=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpip",
                        help="TIMEMORY_BUILD_MPIP=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cuda",
                        help="TIMEMORY_USE_CUDA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cupti",
                        help="TIMEMORY_USE_CUPTI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--upcxx",
                        help="TIMEMORY_USE_UPCXX=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gotcha",
                        help="TIMEMORY_USE_GOTCHA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--caliper",
                        help="TIMEMORY_USE_CALIPER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--likwid",
                        help="TIMEMORY_USE_LIKWID=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--papi",
                        help="TIMEMORY_USE_PAPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpi",
                        help="TIMEMORY_USE_MPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--python",
                        help="TIMEMORY_BUILD_PYTHON=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--extra-optimizations",
                        help="TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--build-libs",
                        help="Build library type(s)",
                        default=("shared"),
                        nargs='*',
                        type=str,
                        choices=("static", "shared"))
    parser.add_argument("--generate",
                        help="Generate the tests only",
                        action='store_true')

    args = parser.parse_args()

    if os.environ.get("CTEST_SITE") is not None:
        pyct.set("CTEST_SITE", "{}".format(os.environ.get("CTEST_SITE")))

    if os.path.exists(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version
        if (_pyctest_version[0] == 0 and _pyctest_version[1] == 0
                and _pyctest_version[2] < 11):
            cmd = pyct.command(
                [cm, "--build", pyct.BINARY_DIRECTORY, "--target", "clean"])
            cmd.SetWorkingDirectory(pyct.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake
            CMake("--build", pyct.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(
            os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt"))

    if platform.system() != "Linux":
        args.papi = False

    os.environ["PYCTEST_TESTING"] = "ON"

    return args
Beispiel #11
0
def configure():

    geant_binary_dir = os.path.join(os.getcwd(), "build-GeantExascalePilot",
                                    platform.system())

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="GeantExascalePilot",
                                    source_dir=os.getcwd(),
                                    binary_dir=geant_binary_dir,
                                    build_type="Release",
                                    vcs_type="git",
                                    use_launchers=True)

    parser.add_argument("--arch",
                        help="GEANT_USE_ARCH=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gperf",
                        help="GEANT_USE_GPERF=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tbb",
                        help="PTL_USE_TBB=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--sanitizer",
                        help="GEANT_USE_SANITIZER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--no-static-analysis",
                        help="GEANT_USE_CLANG_TIDY=OFF",
                        default=False,
                        action='store_true')
    parser.add_argument("--coverage",
                        help="GEANT_USE_COVERAGE=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--num-tasks",
                        help="Set the number of tasks",
                        default=16384,
                        type=int)

    args = parser.parse_args()

    if os.environ.get("CTEST_SITE") is not None:
        pyctest.set("CTEST_SITE", "{}".format(os.environ.get("CTEST_SITE")))

    if os.path.exists(os.path.join(pyctest.BINARY_DIRECTORY,
                                   "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version
        if (_pyctest_version[0] == 0 and _pyctest_version[1] == 0
                and _pyctest_version[2] < 11):
            cmd = pyctest.command(
                [cm, "--build", pyctest.BINARY_DIRECTORY, "--target", "clean"])
            cmd.SetWorkingDirectory(pyctest.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake
            CMake("--build", pyctest.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(
            os.path.join(pyctest.BINARY_DIRECTORY, "CMakeCache.txt"))

    if args.gperf:
        pyctest.copy_files(["gperf_cpu_profile.sh", "gperf_heap_profile.sh"],
                           os.path.join(pyctest.SOURCE_DIRECTORY, ".scripts"),
                           pyctest.BINARY_DIRECTORY)

    return args
Beispiel #12
0
def run_pyctest():

    repo_src = os.path.join(os.getcwd(), "tomopy-src")
    repo_bin = os.path.join(os.getcwd(), "tomopy-bin")
    helpers.RemovePath(repo_src)
    helpers.RemovePath(repo_bin)

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TomoPy",
                                    source_dir=repo_src,
                                    binary_dir=repo_bin,
                                    python_exe=sys.executable,
                                    vcs_type="git",
                                    ctest_args=["-VV"])

    default_repo_url = "https://github.com/tomopy/tomopy.git"
    default_repo_branch = "master"

    parser.add_argument("--repo-url",
                        help="Set the repository URL",
                        type=str,
                        default=default_repo_url)
    parser.add_argument("--repo-branch",
                        help="Branch of the repository",
                        type=str,
                        default=default_repo_branch)
    args = parser.parse_args()

    # executables
    pyexe = pyctest.PYTHON_EXECUTABLE
    pyexe_dir = os.path.dirname(pyexe)
    coverage_exe = os.path.join(pyexe_dir, "coverage")
    nosetests_exe = os.path.join(pyexe_dir, "nosetests")

    # Set the build name
    pyctest.BUILD_NAME = "[{}] [{} {} {}] [Python ({}) {}]".format(
        args.repo_branch,
        platform.uname()[0], helpers.GetSystemVersionInfo(),
        platform.uname()[4], platform.python_implementation(),
        platform.python_version())
    # Set the checkout command
    pyctest.CHECKOUT_COMMAND = "git clone -b {} {} {}".format(
        args.repo_branch, args.repo_url, pyctest.SOURCE_DIRECTORY)
    # Set the configuration command (copy to binary directory)
    pyctest.CONFIGURE_COMMAND = "cmake -E copy_directory {}/ {}/".format(
        pyctest.SOURCE_DIRECTORY, pyctest.BINARY_DIRECTORY)
    # Set the build command
    pyctest.BUILD_COMMAND = "{} setup.py build".format(
        pyctest.PYTHON_EXECUTABLE)

    #--------------------------------------------------------------------------#
    # create a CTest that wraps "nosetest"
    #
    pyctest.test(name="nosetests",
                 cmd=[pyexe, coverage_exe, "run", nosetests_exe],
                 properties={
                     "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
                     "TIMEOUT": "600",
                     "ENVIRONMENT": "OMP_NUM_THREADS=1"
                 })

    pyctest.run()