File: __init__.py

package info (click to toggle)
nvidia-cuda-toolkit 12.4.1-3
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 18,505,836 kB
  • sloc: ansic: 203,477; cpp: 64,769; python: 34,699; javascript: 22,006; xml: 13,410; makefile: 3,085; sh: 2,343; perl: 352
file content (56 lines) | stat: -rw-r--r-- 1,937 bytes parent folder | download | duplicates (6)
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
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation and any modifications thereto. Any use, reproduction,
# disclosure or distribution of this material and related documentation
# without an express license agreement from NVIDIA CORPORATION or
# its affiliates is strictly prohibited.

import sys
import os

from ctypes import cdll

if sys.version_info < (3, 6):
    raise RuntimeError("Python 3.6 or later is required.")

from nsys_recipe import log
from nsys_recipe.log import logger
from nsys_recipe.nsys_constants import *

log.customize_logger("stderr", "info")

try:
    from nsys_recipe.lib import *
    from nsys_recipe.lib.nsys_path import find_installed_file

    # These are modules that might conflict with recipe modules.
    # To avoid ambiguity, we import the parent directory.
    report_modules = [
        NSYS_RULE_DIR,
        NSYS_REPORT_DIR,
    ]
    module_paths = [
        os.path.dirname(find_installed_file(module)) for module in report_modules
    ]

    additional_modules = [NSYS_PYTHON_LIB_DIR, NSYS_RECIPE_THIRDPARTY_PATH]
    module_paths += [find_installed_file(module) for module in additional_modules]

    sys.path = module_paths + sys.path

    # Load the SQLite extension library.
    cdll.LoadLibrary(find_installed_file(NSYS_SQLITE_LIB))

except ModuleNotFoundError as e:
    req_file = NSYS_RECIPE_REQ_COMMON_PATH
    install_file = NSYS_RECIPE_INSTALL_PATH

    logger.error(
        f"{e}\nAll packages listed in '{req_file}' must be installed."
        f" You can automate the installation using the '{install_file}' script."
        " For more information, please refer to the Nsight Systems User Guide."
    )
    sys.exit(1)