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

from pprof.project import Project, ProjectFactory
from pprof.settings import config

from os import path
from plumbum import FG, local


class PolyBenchGroup(Project):

    path_dict = {
        "correlation": "datamining",
        "covariance": "datamining",

        "2mm": "linear-algebra/kernels",
        "3mm": "linear-algebra/kernels",
        "atax": "linear-algebra/kernels",
        "bicg": "linear-algebra/kernels",
        "doitgen": "linear-algebra/kernels",
        "mvt": "linear-algebra/kernels",

        "cholesky": "linear-algebra/solvers",
        "durbin": "linear-algebra/solvers",
        "lu": "linear-algebra/solvers",
        "ludcmp": "linear-algebra/solvers",
        "gramschmidt": "linear-algebra/solvers",
        "trisolv": "linear-algebra/solvers",

        "gemm": "linear-algebra/blas",
        "gemver": "linear-algebra/blas",
        "gesummv": "linear-algebra/blas",
        "symm": "linear-algebra/blas",
        "syr2k": "linear-algebra/blas",
        "syrk": "linear-algebra/blas",
        "trmm": "linear-algebra/blas",

        "adi": "stencils",
        "fdtd-2d": "stencils",
        "heat-3d": "stencils",
        "jacobi-1d": "stencils",
        "jacobi-2d": "stencils",
        "seidel-2d": "stencils",

        "nussinov": "medley",
        "deriche": "medley",
        "floyd-warshall": "medley",
    }

    def __init__(self, exp, name):
        super(PolyBenchGroup, self).__init__(
            exp, name, "polybench", "polybench")
        self.sourcedir = path.join(config["sourcedir"],
                                   "polybench", self.path_dict[name], name)
        self.setup_derived_filenames()

    src_dir = "polybench-c-4.1"
    src_file = src_dir + ".tar.gz"
    src_uri = "http://downloads.sourceforge.net/project/polybench/" + src_file

    def download(self):
        from pprof.utils.downloader import Wget
        from plumbum.cmd import tar
        with local.cwd(self.builddir):
            Wget(self.src_uri, self.src_file)
            tar('xfz', path.join(self.builddir, self.src_file))

    def configure(self):
        from plumbum.cmd import cp
        with local.cwd(self.builddir):
            cp("-ar", path.join(self.src_dir, self.path_dict[self.name],
                                self.name), self.name + ".dir")
            cp("-ar", path.join(self.src_dir, "utilities"), ".")

    def build(self):
        from pprof.utils.compiler import lt_clang

        src_file = path.join(self.name + ".dir", self.name + ".c")
        with local.cwd(self.builddir):
            clang = lt_clang(self.cflags, self.ldflags)
            clang("-I", "utilities",
                  "-I", self.name,
                  "-DPOLYBENCH_USE_C99_PROTO",
                  "utilities/polybench.c", src_file,
                  "-lm",
                  self.cflags, "-o", self.run_f, self.ldflags)


# Datamining

class Correlation(PolyBenchGroup):

    class Factory:

        def create(self, exp):
            return Correlation(exp, "correlation")
    ProjectFactory.addFactory("Correlation", Factory())


class Covariance(PolyBenchGroup):

    class Factory:

        def create(self, exp):
            return Covariance(exp, "covariance")
    ProjectFactory.addFactory("Covariance", Factory())

# Linear Algebra / Kernels

class TwoMM(PolyBenchGroup):

    class Factory:

        def create(self, exp):<commit_msg>polybench: fix cflags/ldflags<commit_after>#!/usr/bin/evn python
# encoding: utf-8

from pprof.project import Project, ProjectFactory
from pprof.settings import config

from os import path
from plumbum import FG, local


class PolyBenchGroup(Project):

    path_dict = {
        "correlation": "datamining",
        "covariance": "datamining",

        "2mm": "linear-algebra/kernels",
        "3mm": "linear-algebra/kernels",
        "atax": "linear-algebra/kernels",
        "bicg": "linear-algebra/kernels",
        "doitgen": "linear-algebra/kernels",
        "mvt": "linear-algebra/kernels",

        "cholesky": "linear-algebra/solvers",
        "durbin": "linear-algebra/solvers",
        "lu": "linear-algebra/solvers",
        "ludcmp": "linear-algebra/solvers",
        "gramschmidt": "linear-algebra/solvers",
        "trisolv": "linear-algebra/solvers",

        "gemm": "linear-algebra/blas",
        "gemver": "linear-algebra/blas",
        "gesummv": "linear-algebra/blas",
        "symm": "linear-algebra/blas",
        "syr2k": "linear-algebra/blas",
        "syrk": "linear-algebra/blas",
        "trmm": "linear-algebra/blas",

        "adi": "stencils",
        "fdtd-2d": "stencils",
        "heat-3d": "stencils",
        "jacobi-1d": "stencils",
        "jacobi-2d": "stencils",
        "seidel-2d": "stencils",

        "nussinov": "medley",
        "deriche": "medley",
        "floyd-warshall": "medley",
    }

    def __init__(self, exp, name):
        super(PolyBenchGroup, self).__init__(
            exp, name, "polybench", "polybench")
        self.sourcedir = path.join(config["sourcedir"],
                                   "polybench", self.path_dict[name], name)
        self.setup_derived_filenames()

    src_dir = "polybench-c-4.1"
    src_file = src_dir + ".tar.gz"
    src_uri = "http://downloads.sourceforge.net/project/polybench/" + src_file

    def download(self):
        from pprof.utils.downloader import Wget
        from plumbum.cmd import tar
        with local.cwd(self.builddir):
            Wget(self.src_uri, self.src_file)
            tar('xfz', path.join(self.builddir, self.src_file))

    def configure(self):
        from plumbum.cmd import cp
        with local.cwd(self.builddir):
            cp("-ar", path.join(self.src_dir, self.path_dict[self.name],
                                self.name), self.name + ".dir")
            cp("-ar", path.join(self.src_dir, "utilities"), ".")

    def build(self):
        from pprof.utils.compiler import lt_clang

        src_file = path.join(self.name + ".dir", self.name + ".c")
        with local.cwd(self.builddir):
            clang = lt_clang(self.cflags, self.ldflags)
            clang("-I", "utilities",
                  "-I", self.name,
                  "-DPOLYBENCH_USE_C99_PROTO",
                  "utilities/polybench.c", src_file,
                  "-lm",
                  "-o", self.run_f)


# Datamining

class Correlation(PolyBenchGroup):

    class Factory:

        def create(self, exp):
            return Correlation(exp, "correlation")
    ProjectFactory.addFactory("Correlation", Factory())


class Covariance(PolyBenchGroup):

    class Factory:

        def create(self, exp):
            return Covariance(exp, "covariance")
    ProjectFactory.addFactory("Covariance", Factory())

# Linear Algebra / Kernels

class TwoMM(PolyBenchGroup):

    class Factory:

        def create(self, exp):
{'fraction_non_alphanumeric': 0.14691735898557062, 'fraction_numerical': 0.003789535053199242, 'mean_word_length': 2.289549376797699, 'pattern_counts': {'":': 60, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3208237', 'n_tokens_mistral': 2343, 'n_tokens_neox': 2210, 'n_words': 411}