예제 #1
0
    def __init__(self,
                 truffleruby_dir=None,
                 graal_home=None,
                 mx_dir=None,
                 jvmci_home=None,
                 env=None):
        """
        Args:
            truffleruby_dir: path to a (built) truffleruby src dir
            graal_home: path to the built graal-core directory
            mx_dir: path to mx directory

        Note that this is for the open-source graal-core powered TruffleRuby,
        not for the proprietary graalvm binaries found on Oracle Technology
        Network.
        """

        jtrb_path = os.path.join(truffleruby_dir, 'tool', 'jt.rb')
        mx_bin_dir = os.path.join(mx_dir, "bin")

        RubyVMDef.__init__(self, jtrb_path, env=env)
        self.add_env_change(EnvChangeAppend("GRAAL_HOME", graal_home))
        self.add_env_change(EnvChangeAppend("PATH", mx_dir))
        self.extra_vm_args += ['run', '--graal']

        if jvmci_home is not None:
            self.add_env_change(EnvChangeSet("JAVA_HOME", jvmci_home))
예제 #2
0
파일: vm_defs.py 프로젝트: warsier/krun
    def run_exec(self, entry_point, iterations,
                 param, heap_lim_k, stack_lim_k, key, key_pexec_idx,
                 force_dir=None, sync_disks=True):
        """Running Java experiments is different due to the way that the JVM
        doesn't simply accept the path to a program to run. We have to set
        the CLASSPATH and then provide a class name instead"""

        benchmark = key.split(":")[0]
        bench_dir = os.path.dirname(self._get_benchmark_path(
            benchmark, entry_point, force_dir=force_dir))

        # deal with CLASSPATH
        # This has to be added here as it is benchmark specific
        bench_env_changes = [
            EnvChangeAppend("CLASSPATH", ITERATIONS_RUNNER_DIR),
            EnvChangeAppend("CLASSPATH", bench_dir),
        ]

        args = [self.vm_path] + self.extra_vm_args
        args += [self.iterations_runner, entry_point.target,
                 str(iterations), str(param)]

        
        args = self.customized_submit + args
        print(args)

        return self._run_exec(args, heap_lim_k, stack_lim_k, key,
                              key_pexec_idx,
                              bench_env_changes=bench_env_changes,
                              sync_disks=sync_disks)
예제 #3
0
파일: test_env.py 프로젝트: bennn/krun
def test_env_change_append():
    env = EnvChangeAppend("bach", 1685)
    assert env.var == "bach"
    assert env.val == 1685
    my_dict0 = {"handel": 1685}
    env.apply(my_dict0)
    assert my_dict0["bach"] == 1685
    assert my_dict0["handel"] == 1685
    my_dict1 = {"bach": 1750, "handel": 1759}
    env.apply(my_dict1)
    assert my_dict1["bach"] == "1750" + os.pathsep + "1685"
    assert my_dict1["handel"] == 1759
예제 #4
0
 def bench_env_changes(self):
     # Force libkruntime into linker path.
     # We are working on the assumption that no-one else uses
     # LD_LIBRARY_PATH (or equivalent) elsewhere. EnvChangeSet will check
     # this and crash out if this assumption is invalid.
     return [EnvChangeAppend(self.FORCE_LIBRARY_PATH_ENV_NAME,
                             LIBKRUNTIME_DIR)]
예제 #5
0
파일: vm_defs.py 프로젝트: bennn/krun
    def __init__(self, iterations_runner, env=None):
        self.iterations_runner = iterations_runner

        # List of EnvChange instances to apply prior to each experiment.
        # These should be benchmark agnostic. Look elsewhere for
        # environment changes specific to a benchmark.
        self.common_env_changes = []

        # The user can pass in a dict to influence the environment.
        #
        # These variables are *prepended* to any coinsiding environment that
        # Krun has set to run benchmarks. E.g. If Krun wants to set
        # LD_LIBRARY_PATH=/opt/pypy/pypy/goal, and the user passes down
        # {"LD_LIBRARY_PATH": "/wibble/lib"}, the resulting environment is
        # LD_LIBRARY_PATH=/wibble/lib:/opt/pypy/pypy/goal
        #
        # This is useful, for example, if the user built their own GCC
        # and needs to force the LD_LIBRARY_PATH.
        if env is not None:
            if not isinstance(env, dict):
                fatal("'env' argument for VM defs should be a dict")
            for k, v in env.iteritems():
                self.add_env_change(EnvChangeAppend(k, v))

        # tempting as it is to add a self.vm_path, we don't. If we were to add
        # natively compiled languages, then there is no "VM" to speak of.

        self.platform = None  # Set later

        # Do not execute the benchmark program
        # (useful for testing configurations.).
        self.dry_run = False
예제 #6
0
def test_user_env0003():
    config = Config(os.path.join(TEST_DIR, "env.krun"))
    vm_def = config.VMS["CPython"]["vm_def"]

    env = {"LD_LIBRARY_PATH": "zzz"}

    bench_env_changes = [EnvChangeAppend("LD_LIBRARY_PATH", "abc")]
    vm_def.apply_env_changes(bench_env_changes, env)
    assert env == {
        'ANOTHER_ENV': 'arbitrary_user_val',
        'LD_LIBRARY_PATH': 'zzz:/wibble/lib:abc',
    }
예제 #7
0
파일: vm_defs.py 프로젝트: bennn/krun
 def __init__(self, vm_path, env=None):
     GenericScriptingVMDef.__init__(self, vm_path, "iterations_runner.py",
                                    env=env)
     # XXX: On OpenBSD the PyPy build fails to encode the rpath to libpypy-c.so
     # into the VM executable, so we have to force it ourselves.
     #
     # For fairness, we apply the environment change to all platforms.
     #
     # Ideally fix in PyPy.
     # The user's environment (if any) comes first however
     lib_dir = os.path.dirname(vm_path)
     self.add_env_change(EnvChangeAppend("LD_LIBRARY_PATH", lib_dir))
예제 #8
0
def test_env_change_append():
    env = EnvChangeAppend("bach", 1685)
    assert env.var == "bach"
    assert env.val == 1685
    my_dict0 = {"handel": 1685}
    env.apply(my_dict0)
    assert my_dict0["bach"] == 1685
    assert my_dict0["handel"] == 1685
    my_dict1 = {"bach": 1750, "handel": 1759}
    env.apply(my_dict1)
    assert my_dict1["bach"] == "1750" + os.pathsep + "1685"
    assert my_dict1["handel"] == 1759
예제 #9
0
파일: vm_defs.py 프로젝트: warsier/krun
    def __init__(self, vm_path, env=None, instrument=False):
        """When instrument=True, record GC and compilation events"""

        if instrument:
            if env is None:
                env = {}
            # Causes PyPy to emit VM events on stderr
            EnvChangeSet("PYPYLOG", "gc:-").apply(env)

        PythonVMDef.__init__(self, vm_path, env=env, instrument=instrument)

        # XXX: On OpenBSD the PyPy build fails to encode the rpath to libpypy-c.so
        # into the VM executable, so we have to force it ourselves.
        #
        # For fairness, we apply the environment change to all platforms.
        #
        # Ideally fix in PyPy.
        # The user's environment (if any) comes first however
        lib_dir = os.path.dirname(vm_path)
        self.add_env_change(EnvChangeAppend("LD_LIBRARY_PATH", lib_dir))
예제 #10
0
파일: vm_defs.py 프로젝트: bennn/krun
    def __init__(self, vm_path, java_path, env=None):
        JRubyVMDef.__init__(self, vm_path, env=env)
        self.add_env_change(EnvChangeAppend("JAVACMD", java_path))

        self.extra_vm_args += ['-X+T', '-J-server']