To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

__init__.py 1.82 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python3
# Copyright 2017 The Australian National University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
15
import os
John Zhang's avatar
John Zhang committed
16
import time
17

18
from pathlib import Path
19

20
21
from mubench import CALLBACKS_DIR
from mubench.util import expandenv
22
from mubench.util import run_in_subproc
23

24
25
26
27
class Language:
    name = None
    src_ext = None
    compiled = True
28
    default_cc = 'clang'
29
30

    @classmethod
John Zhang's avatar
John Zhang committed
31
32
    def check_lang(cls, lc):
        return lc
33
34

    @classmethod
John Zhang's avatar
John Zhang committed
35
    def check_compiler(cls, cc, lc, task):
36
37
38
        return cc

    @classmethod
John Zhang's avatar
John Zhang committed
39
    def check_runner(cls, rc, lc, task):
40
41
        return rc

42
43
44
45
46
47
48
    @classmethod
    def get_default_target(cls, task):
        target_dir = task.output_dir
        target_name = '%s-%s' % (task.taskset.name, task.name)
        target = target_dir / target_name
        return target

49
50
    @classmethod
    def compile(cls, task):
51
52
53
        raise NotImplementedError

    @classmethod
54
    def run(cls, target, task):
55
56
57
58
        raise NotImplementedError


def get_lang(name):
John Zhang's avatar
John Zhang committed
59
60
61
    from mubench.lang.python import Python
    from mubench.lang.rpython import RPython
    from mubench.lang.c import C
62
    from mubench.lang.mu import Mu
Zixian Cai's avatar
Zixian Cai committed
63
    from mubench.lang.wasm import WASM
64
65
    lang_dict = {
        'python': Python,
66
        'rpython': RPython,
67
        'c': C,
68
        'mu': Mu,
Zixian Cai's avatar
Zixian Cai committed
69
        'wasm': WASM,
70
71
    }
    return lang_dict[name]