Beispiel #1
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments = [
            '-f', '{0}'.format(self.get_arg("--mdp=")), '-c',
            '{0}'.format(self.get_arg("--gro=")), '-p',
            '{0}'.format(self.get_arg("--top=")), '-o',
            '{0}'.format(self.get_arg("--tpr="))
        ]
        if self.get_arg("--ref=") is not None:
            arguments += ['-r', '{0}'.format(self.get_arg("--ref="))]

        self._executable = cfg['executable']
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
Beispiel #2
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        executable = cfg["executable"]
        arguments = [
            '--grid', '{0}'.format(self.get_arg("--grid=")), '--dims',
            '{0}'.format(self.get_arg("--dims=")), '--frontpoints',
            '{0}'.format(self.get_arg("--frontpoints=")), '--topfile',
            '{0}'.format(self.get_arg("--topfile=")), '--mdfile',
            '{0}'.format(self.get_arg("--mdfile=")), '--output', '{0}'.format(
                self.get_arg("--output=")), '--logfile', 'coco.log', '--mpi',
            '--selection', '{0}'.format(self.get_arg("--atom_selection="))
        ]

        self._executable = executable
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
Beispiel #3
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        executable = cfg["executable"]
        arguments = [
            'postexec.py', '{0}'.format(self.get_arg("--numofsims=")),
            '{0}'.format(self.get_arg("--cycle="))
        ]

        self._executable = executable
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
        self._post_exec = None
Beispiel #4
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        executable = "/bin/bash"
        arguments = [
            '-l', '-c',
            'diff -U 0 {input1} {input2} | grep ^@ | wc -l  > {output}'.format(
                input1=self.get_arg("--inputfile1="),
                input2=self.get_arg("--inputfile2="),
                output=self.get_arg("--outputfile="))
        ]

        self._executable = executable
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = None
Beispiel #5
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        executable = "/bin/bash"
        arguments = [
            '-l', '-c', '{0} /dev/urandom | head -c {1} > {2}'.format(
                cfg["executable"], self.get_arg("--size="),
                self.get_arg("--filename="))
        ]

        self._executable = executable
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments = [
            'post_analyze.py', '{0}'.format(self.get_arg("--num_runs=")),
            'tmpha.ev', 'ncopies.nc', 'tmp.gro', 'out.nn', 'weight.w',
            '{0}'.format(self.get_arg("--out=")),
            '{0}'.format(self.get_arg("--max_alive_neighbors=")),
            '{0}'.format(self.get_arg("--max_dead_neighbors=")), 'input.gro',
            '{0}'.format(self.get_arg("--cycle="))
        ]

        self._executable = cfg["executable"]
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
Beispiel #7
0
    def _bind_to_resource(self, resource_key):

        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        #change to pmemd.MPI by splitting into two kernels
        arguments = [
            '{0}'.format(self.get_arg("--script=")), '--imagepath',
            '{0}'.format(self.get_arg("--imagepath=")), '--trainingpath',
            '{0}'.format(self.get_arg("--trainingpath=")), '--num_train',
            '{0}'.format(self.get_arg("--num_train=")), '--icetypes',
            '{0}'.format(self.get_arg("--icetypes="))
        ]

        self._executable = cfg["executable"]
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
Beispiel #8
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        #change to pmemd.MPI when cores can be set
        arguments = [
            'run.py', '--mdp',
            '%s' % self.get_arg("--grompp="), '--gro', 'start.gro', '--top',
            '%s' % self.get_arg('--topol='), '--out', 'out.gro'
        ]

        self._executable = cfg["executable"]
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
Beispiel #9
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments = [
            '-nt', '{0}'.format(self.get_arg("--size=")), '-s',
            '{0}'.format(self.get_arg('--tpr=')), '-c',
            '{0}'.format(self.get_arg('--out='))
        ]
        if self.get_arg('--trr=') is not None:
            arguments.extend(['-o', '{0}'.format(self.get_arg('--trr='))])

        if self.get_arg('--edr=') is not None:
            arguments.extend(['-e', '{0}'.format(self.get_arg('--edr='))])

        self._executable = cfg["executable"]
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
        self._post_exec = None
Beispiel #10
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        executable = cfg['executable']
        arguments = [
            '-l', '-c', "/bin/cat {1} >> {0}".format(self.get_arg("--file1="),
                                                     self.get_arg("--file2="))
        ]

        self._executable = executable
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = None
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments = [
            '-l', '-c',
            'echo {0} | gmx trjconv -f {1} -o {3} -s {2} -pbc {4}'.format(
                self.get_arg("--echo="), self.get_arg("--f="),
                self.get_arg("--s="), self.get_arg("--o="),
                self.get_arg("--pbc="))
        ]

        self._executable = cfg['executable']
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(kernel_name=_KERNEL_INFO["name"], \
                                                 resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        if self._subname == None:
            arguments = [
                self.get_arg("--calculator="),
                self.get_arg("--replica_id="),
                self.get_arg("--replica_cycle="),
                self.get_arg("--replicas="),
                self.get_arg("--replica_basename=")
            ]
            self._executable = cfg["executable"]
            self._arguments = arguments
            self._environment = cfg["environment"]
            self._uses_mpi = cfg["uses_mpi"]
            self._pre_exec = cfg["pre_exec"]
            self._post_exec = None
        elif self._subname == "matrix_calculator_temp_ex":
            arguments = [
                self.get_arg("--calculator="),
                self.get_arg("--replica_id="),
                self.get_arg("--replica_cycle="),
                self.get_arg("--replicas="),
                self.get_arg("--replica_basename="),
                self.get_arg("--new_temperature=")
            ]
            self._executable = cfg["executable"]
            self._arguments = arguments
            self._environment = cfg["environment"]
            self._uses_mpi = cfg["uses_mpi"]
            self._pre_exec = cfg["pre_exec"]
            self._post_exec = None
        elif self._subname == "global_ex_calculator":
            arguments = [
                self.get_arg("--calculator="),
                self.get_arg("--replica_cycle="),
                self.get_arg("--replicas="),
                self.get_arg("--replica_basename=")
            ]
            self._executable = cfg["executable"]
            self._arguments = arguments
            self._environment = cfg["environment"]
            self._uses_mpi = True
            self._pre_exec = cfg["pre_exec"]
            self._post_exec = None
Beispiel #13
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        self._executable = cfg["executable"]
        self._arguments = self.get_raw_args()
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._pre_exec = cfg["pre_exec"]
Beispiel #14
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(kernel_name=_KERNEL_INFO["name"], resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments = ['-f','{0}'.format(self.get_arg("--config=")),'-c','tmpha.gro','-n','out.nn','-w','weight.w']

        self._executable  = cfg["executable"]
        self._arguments   = arguments
        self._environment = cfg["environment"]
        self._uses_mpi    = cfg["uses_mpi"]
        self._pre_exec    = cfg["pre_exec"]
Beispiel #15
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method.
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments = [
            '-m',
            '{0}'.format(self.get_arg('--mode=')),
            '-f',
            '{0}'.format(self.get_arg('--flops=')),
            '-s',
            '{0}'.format(self.get_arg('--samples=')),
        ]

        if self.get_arg('--input=') is not None:
            arguments.extend('-i', '{0}'.format(self.get_arg('--input=')))

        if self.get_arg('--output=') is not None:
            arguments.extend('-o', '{0}'.format(self.get_arg('--output=')))

        if self.get_arg('--memory=') is not None:
            arguments.extend('-r', '{0}'.format(self.get_arg('--memory=')))

        self._pre_exec = [
            'export PYTHONPATH={0}/lib/python2.7/site-packages'.format(
                self.get_arg("--path=")),
            'export PATH=$PATH:{0}/bin'.format(self.get_arg("--path=")),
        ]
        self._executable = cfg['executable']
        self._arguments = arguments
        self._environment = cfg["environment"]
        self._uses_mpi = cfg["uses_mpi"]
        self._post_exec = None
Beispiel #16
0
    def _bind_to_resource(self, resource_key):
        """(PRIVATE) Implements parent class method. 
        """
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "*" in _KERNEL_INFO["machine_configs"]:
                # Fall-back to generic resource key
                resource_key = "*"
            else:
                raise NoKernelConfigurationError(kernel_name=_KERNEL_INFO["name"], resource_key=resource_key)

        cfg = _KERNEL_INFO["machine_configs"][resource_key]

        arguments  = ['-l', '-c', 'python levenshtein.py {0} {1} > {2}'.format(
            self.get_arg("--inputfile1="),
            self.get_arg("--inputfile2="),
            self.get_arg("--outputfile="))
        ]

        self._executable  = cfg["executable"] 
        self._arguments   = arguments
        self._environment = cfg["environment"]
        self._uses_mpi    = cfg["uses_mpi"]
        self._pre_exec    = cfg["pre_exec"] 
Beispiel #17
0
    def _bind_to_resource(self, resource_key, pattern_name=None):
        """(PRIVATE) Implements parent class method. 
        """

        if (pattern_name == None):

            if resource_key not in _KERNEL_INFO["machine_configs"]:
                if "*" in _KERNEL_INFO["machine_configs"]:
                    # Fall-back to generic resource key
                    resource_key = "*"
                else:
                    raise NoKernelConfigurationError(
                        kernel_name=_KERNEL_INFO["name"],
                        resource_key=resource_key)

            cfg = _KERNEL_INFO["machine_configs"][resource_key]

            #change to pmemd.MPI by splitting into two kernels
            if self.get_arg("--mininfile=") is not None:
                arguments = [
                    '-O', '-i',
                    self.get_arg("--mininfile="), '-o',
                    'min%s.out' % self.get_arg("--cycle="), '-inf',
                    'min%s.inf' % self.get_arg("--cycle="), '-r',
                    'md%s.crd' % self.get_arg("--cycle="), '-p',
                    self.get_arg("--topfile="), '-c',
                    self.get_arg("--crdfile="), '-ref',
                    'min%s.crd' % self.get_arg("--cycle=")
                ]
            else:
                arguments = [
                    '-O',
                    '-i',
                    self.get_arg("--mdinfile="),
                    '-o',
                    'md%s.out' % self.get_arg("--cycle="),
                    '-inf',
                    'md%s.inf' % self.get_arg("--cycle="),
                    '-x',
                    'md%s.ncdf' % self.get_arg("--cycle="),
                    '-r',
                    'md%s.rst' % self.get_arg("--cycle="),
                    '-p',
                    self.get_arg("--topfile="),
                    '-c',
                    'md%s.crd' % self.get_arg("--cycle="),
                ]

            self._executable = cfg["executable"]
            self._arguments = arguments
            self._environment = cfg["environment"]
            self._uses_mpi = False
            self._pre_exec = cfg["pre_exec"]

        #-----------------------------------------------------------------------
        # below only for RE
        elif (pattern_name == 'ReplicaExchange'):
            # if (pattern_name == None):
            cfg = _KERNEL_INFO["machine_configs"][resource_key]

            if resource_key not in _KERNEL_INFO["machine_configs"]:
                if "*" in _KERNEL_INFO["machine_configs"]:
                    # Fall-back to generic resource key
                    resource_key = "*"
                else:
                    raise NoKernelConfigurationError(kernel_name=KERNEL_INFO["name"], \
                                                     resource_key=resource_key)

            cfg = _KERNEL_INFO["machine_configs"][resource_key]

            if self._uses_mpi:
                self._executable = cfg["executable"] + ".MPI"
            else:
                self._executable = cfg["executable"]
                # by default MPI is false
                self._uses_mpi = cfg["uses_mpi"]
            self._arguments = [
                "-O ", "-i ",
                self.get_arg("--mdinfile="), "-o ",
                self.get_arg("--outfile="), "-p ",
                self.get_arg("--params="), "-c ",
                self.get_arg("--coords="), "-r ",
                self.get_arg("--nwcoords="), "-x ",
                self.get_arg("--nwtraj="), "-inf ",
                self.get_arg("--nwinfo=")
            ]

            self._environment = cfg["environment"]

            if not self._pre_exec:
                self._pre_exec = cfg["pre_exec"]
            else:
                self._pre_exec = self._pre_exec + cfg["pre_exec"]
Beispiel #18
0
    def test_NoKernelConfigurationError(self):
        from radical.ensemblemd.exceptions import NoKernelConfigurationError

        _KERNEL_INFO = {
            "name": "misc.ccount",
            "description": "Counts the character frequency in an ASCII file.",
            "machine_configs": {
                "*": {
                    "environment": None,
                    "pre_exec": None,
                    "executable": "uniq",
                    "uses_mpi": False
                }
            }
        }
        resource_key = "random"
        if resource_key not in _KERNEL_INFO["machine_configs"]:
            if "hi" in _KERNEL_INFO["machine_configs"]:
                resource_key = "*"
            else:
                assert "Kernel 'misc.ccount' doesn not have a configuration entry for resource key 'random'." in NoKernelConfigurationError(
                    kernel_name=_KERNEL_INFO["name"],
                    resource_key=resource_key)