File: build_amd.py

package info (click to toggle)
gloo 0.0~git20231202.5354032-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 2,148 kB
  • sloc: cpp: 21,546; python: 8,179; sh: 68; makefile: 67
file content (77 lines) | stat: -rwxr-xr-x 1,642 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env python3

from __future__ import absolute_import, division, print_function

import argparse
import os

from pyHIPIFY import hipify_python

parser = argparse.ArgumentParser(
    description="Top-level script for HIPifying, filling in most common parameters"
)
parser.add_argument(
    "--project-directory",
    type=str,
    default=os.path.normpath(
        os.path.join(
            os.path.realpath(__file__),
            os.pardir,
            os.pardir,
            os.pardir,
        )
    ),
    help="The root of the project. (default: %(default)s)",
    required=False,
)

parser.add_argument(
    "--output-directory",
    type=str,
    default="",
    help="The Directory to Store the Hipified Project",
    required=False,
)

parser.add_argument(
    "--list-files-only",
    action="store_true",
    help="Only print the list of hipify files.",
)

parser.add_argument(
    "--root-dir",
    type=str,
    default="gloo",
    help="The root directory of gloo project",
    required=False,
)


args = parser.parse_args()

amd_build_dir = os.path.dirname(os.path.realpath(__file__))
proj_dir = os.path.join(os.path.dirname(os.path.dirname(amd_build_dir)))

if args.project_directory:
    proj_dir = args.project_directory

out_dir = proj_dir
if args.output_directory:
    out_dir = args.output_directory

includes = [
    os.path.join(args.root_dir, "*cuda*"),
    os.path.join(args.root_dir, "*nccl*"),
]

ignores = []

hipify_python.hipify(
    project_directory=proj_dir,
    output_directory=out_dir,
    includes=includes,
    ignores=ignores,
    list_files_only=args.list_files_only,
    show_progress=False,
)