<commit_before>#!/usr/bin/evn python
# encoding: utf-8

from pprof.project import ProjectFactory, log
from pprof.settings import config
from group import PprofGroup

from os import path
from glob import glob
from plumbum import FG, local


class Lammps(PprofGroup):

    """ LAMMPS benchmark """

    class Factory:

        def create(self, exp):
            return Lammps(exp, "lammps", "scientific")
    ProjectFactory.addFactory("Lammps", Factory())

    def prepare(self):
        super(PprofGroup, self).prepare()
        from plumbum.cmd import cp

        with local.cwd(self.builddir):
            cp("-vr", self.testdir, "test")

    def run_tests(self, experiment):
        from pprof.project import wrap

        exp = wrap(self.run_f, experiment)

        with local.cwd(path.join(self.builddir, "test")):
            tests = glob(path.join(self.testdir, "in.*"))
            for test in tests:
                cmd = (exp < test)
                cmd & FG(retcode=None)

    src_dir = "lammps.git"
    src_uri = "https://github.com/lammps/lammps"

    def download(self):
        from pprof.utils.downloader import Git

        with local.cwd(self.builddir):
            Git(self.src_uri, self.src_dir)

    def configure(self):
        pass

    def build(self):
        from plumbum.cmd import make, ln
        from pprof.utils.compiler import clang_cxx, clang

        with local.cwd(path.join(self.builddir, self.src_dir, "src")):
            make["CC=" + str(clang_cxx()),
                 "CCFLAGS=" + " ".join(self.cflags),
                 "LINKFLAGS=" + " ".join(self.ldflags), "-j4",
                 "clean", "serial"] & FG

        lammps_dir = path.join(self.builddir, self.src_dir, "src")
        with local.cwd(self.builddir):
            ln("-sf", path.join(lammps_dir, "lmp_serial"), self.run_f)<commit_msg>lammps: use lt_clang/lt_clang_cxx for building<commit_after>#!/usr/bin/evn python
# encoding: utf-8

from pprof.project import ProjectFactory, log
from pprof.settings import config
from group import PprofGroup

from os import path
from glob import glob
from plumbum import FG, local


class Lammps(PprofGroup):

    """ LAMMPS benchmark """

    class Factory:

        def create(self, exp):
            return Lammps(exp, "lammps", "scientific")
    ProjectFactory.addFactory("Lammps", Factory())

    def prepare(self):
        super(PprofGroup, self).prepare()
        from plumbum.cmd import cp

        with local.cwd(self.builddir):
            cp("-vr", self.testdir, "test")

    def run_tests(self, experiment):
        from pprof.project import wrap

        lammps_dir = path.join(self.builddir, self.src_dir, "src")
        exp = wrap(path.join(lammps_dir, "lmp_serial"), experiment)

        with local.cwd(path.join(self.builddir, "test")):
            tests = glob(path.join(self.testdir, "in.*"))
            for test in tests:
                cmd = (exp < test)
                cmd & FG(retcode=None)

    src_dir = "lammps.git"
    src_uri = "https://github.com/lammps/lammps"

    def download(self):
        from pprof.utils.downloader import Git

        with local.cwd(self.builddir):
            Git(self.src_uri, self.src_dir)

    def configure(self):
        pass

    def build(self):
        from plumbum.cmd import make, ln
        from pprof.utils.compiler import lt_clang, lt_clang_cxx

        clang = lt_clang(self.cflags, self.ldflags)
        clang_cxx = lt_clang_cxx(self.cfalgs, self.ldflags)

        with local.cwd(path.join(self.builddir, self.src_dir, "src")):
            make["CC=" + str(clang_cxx()),
                 "clean", "serial"] & FG
{'fraction_non_alphanumeric': 0.12313638873550524, 'fraction_numerical': 0.0008282716731087797, 'mean_word_length': 2.4243856332703215, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5500935', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1164, 'n_words': 271}