python_code
stringlengths
0
456k
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
from pycutlass.test.profiler import * from pycutlass.test.conv2d_testbed import * from pycutlass.test.gemm_testbed import * from pycutlass.test.gemm_grouped_testbed import *
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
from pycutlass.utils.reference_model import *
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
# Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
################################################################################ # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
################################################################################ # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
################################################################################ # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
################################################################################ # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
################################################################################ # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
################################################################################ # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
#!/usr/bin/env python from __future__ import absolute_import, division, print_function import os import sys import subprocess import argparse from functools import reduce from itertools import chain from pyHIPIFY import hipify_python parser = argparse.ArgumentParser(description='Top-level script for HIPifying, filli...
import collections from pyHIPIFY.constants import * """ Mapping of CUDA functions, include files, constants, and types to ROCm/HIP equivalents This closely follows the implementation in hipify-clang https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/src/CUDA2HipMap.cpp and its structure. There are d...
""" Constants for annotations in the mapping. The constants defined here are used to annotate the mapping tuples in cuda_to_hip_mappings.py. They are based on https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/src/Statistics.h and fall in three categories: 1) type of mapping, 2) API of mapping, 3) uns...
#!/usr/bin/env python """ The Python Hipify script. ## # Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. # 2017-2018 Advanced Micro Devices, Inc. and # Facebook Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtai...
# -*- coding: utf-8 -*- import unittest from collections import namedtuple from flake8_coding import CodingChecker from mock import patch Options = namedtuple('Options', 'no_accept_encodings, accept_encodings') class TestFlake8Coding(unittest.TestCase): def test_has_utf8_coding_header(self): checker ...
# -*- coding: utf-8 -*- import re from setuptools import setup def get_version(filename): """ Return package version as listed in `__version__` in `filename`. """ init_py = open(filename).read() return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1) version = get_version('flake...
# -*- coding: utf-8 -*- import re __version__ = '1.3.3' class CodingChecker(object): name = 'flake8_coding' version = __version__ def __init__(self, tree, filename): self.filename = filename @classmethod def add_options(cls, parser): parser.add_option( '--accept-enc...
# -*- coding: latin-1 -*-
#!/usr/bin/python # # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#!/usr/bin/python # -*- coding: utf -*-
#!/usr/bin/python #
#!/usr/bin/python # vim: set fileencoding=utf-8 :
#!/usr/bin/python # -*- coding: utf-8 -*-
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import sys import argparse import json from hipify import hipify_python def mai...
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import os import sys import argparse import json def main(): parser = argparse.Argume...
__version__ = '1.0.0'
import collections from .constants import (API_BLAS, API_C10, API_CAFFE2, API_DRIVER, API_FFT, API_PYTORCH, API_RAND, API_ROCTX, API_RTC, API_RUNTIME, API_SPARSE, CONV_CACHE, CONV_CONTEXT, CONV_D3D9, CONV_D3D10, CONV_D3D11, CONV_DEF, CONV_DEVICE, ...
""" Constants for annotations in the mapping. The constants defined here are used to annotate the mapping tuples in cuda_to_hip_mappings.py. They are based on https://github.com/ROCm-Developer-Tools/HIP/blob/master/hipify-clang/src/Statistics.h and fall in three categories: 1) type of mapping, 2) API of mapping, 3) uns...
from .version import __version__
#!/usr/bin/env python3 """ The Python Hipify script. ## # Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved. # 2017-2018 Advanced Micro Devices, Inc. and # Facebook Inc. All rights reserved. # # Permission is hereby granted, free of charge, to any person obta...
#!/usr/bin/env python3 # # This file has been generated by conda-smithy in order to build the recipe # locally. # import os import glob import subprocess from argparse import ArgumentParser import platform def setup_environment(ns): os.environ["CONFIG"] = ns.config os.environ["UPLOAD_PACKAGES"] = "False" ...
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import os import re import setuptools this_dir = os.path.dirname(os.path.abspath(__file__)) d...
import argparse import re from typing import Tuple from setup import find_version def get_next_version(release_type) -> Tuple[Tuple[int, int, int], str, str]: current_ver = find_version("fairscale/version.py") version_list = [int(x) for x in current_ver.strip("'").split(".")] major, minor, patch = versio...
__version_tuple__ = (0, 4, 13)
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. ################################################################################ # Import most common subpackages # # NOT...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. ################################################################################ # Import most common subpackages #######...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from contextlib import contextmanager from dataclasses import dataclass from enum import Enum, auto from functools import lru_cache from typin...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List __all__: List[str] = []
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import logging from typing import Dict, List, Set import torch import torch.fx from torch.fx.node import Node def _get_count(param_count: D...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List from .mevo import BaselineSoftmaxNllLoss from .mevo import MemoryEfficientVocabOutput as MEVO from .offload import Of...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List, Optional, Tuple import torch from torch import Tensor import torch.distributed as dist from torch.distrib...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Optional, Tuple import torch from torch import nn import torch.distributed as dist import torch.nn.functional as F ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from builtins import isinstance import functools import logging from typing import Any, List, Tuple import torch from torch import nn def ...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import time from typing import Any, Dict, List, Tuple, Union import torch from torch import nn from torch.autograd.profi...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List __all__: List[str] = []
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """The AMPnetPipe interface.""" from typing import Any from torch import nn from torch.optim.optimizer import Optimizer...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from .gossip import SlowMoBaseAlgorithm, SlowMoDistributedDataParallel # noqa
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Mixing Manager Class :description: Class provides an API for dynamically selecting mixing weights for ...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from .distributed import SlowMoBaseAlgorithm, SlowMoDistributedDataParallel from .gossiper import PushPull, PushSum from ...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Distributed Gossip Wrapper :description: Multi-Threaded Gossip Model Wrapper; designed for efficient m...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Graph Manager Class :description: Class provides an API for loading different peer-to-peer communication topolog...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Gossipers :description: Gossiper's are designed for multi-peer communication (i.e., send and recv from...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from .helpers import ( MultiProcessAdapter, communicate, create_process_group, flatten_tensors, group...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Benchmarking utils for timing cuda executions """ from collections import defaultdict, deque from functools import p...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Collection of commonly used utility functions """ import collections import logging import sys from typing import An...
import inspect import operator from typing import Dict, List, Optional, Tuple, cast from torch.distributed.nn import RemoteModule import torch.fx import torch.nn as nn from . import PipelineModulesGraph class RemoteModuleTracer(torch.fx.Tracer): def is_leaf_module(self, m: torch.nn.Module, module_qualified_name...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass from typing import List, Optional, Set, Tuple, Union from torch import Tensor, nn from torch.distributed im...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from .graph import PipelineModulesGraph from .loss import DistributedLoss from .pipeline import DistributedPipeline
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from threading import Condition from types import TracebackType from typing import Dict, List, Optional, Tuple, Type, Uni...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import Callable, Dict, Tuple from torch import nn from torch.distributed import rpc def _rloss(loss_func: ...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass from typing import Any, Dict, List, Optional, Union import torch from torch import Ten...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from dataclasses import dataclass from typing import Generic, TypeVar ConsumerType = TypeVar("ConsumerType") @dataclass class DataConsumer(...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ To prevent underflow or overflow of gradients, DynamicLossScaler is used to dynamically scale up and down gradients b...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List from .dynamic_loss_scaler import DynamicLossScaler __all__: List[str] = []
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from enum import Enum from typing import Optional, Tuple import torch from torch import Tensor # Helper Functions def ...
__version_tuple__ = (0, 0, 1)
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List import torch from torch import Tensor class EnergyConcentrationProfile: """Compute "energy...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import sys from typing import List # Check for user requirements before we import our code. try: import pygit2 except ImportError: pr...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import argparse from pathlib import Path from typing import List from . import Repo, version def main(argv: List[str] = None) -> None: ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from enum import Enum class ExitCode(Enum): """Collections of the Exit codes as an Enum class""" CLEAN = 0 FILE_EXISTS_ERROR = ...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import copy from dataclasses import dataclass from enum import Enum import json from pathlib import Path import sys from typing import Any, Di...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from pathlib import Path import subprocess import sys from typing import Dict, List, Tuple import pygit2 class PyGit: """ PyGit cla...
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from .cli import main if __name__ == "__main__": main()
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. import hashlib import json import logging import os from pathlib import Path import pickle import shutil import sys import tempfile import ti...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List __all__: List[str] = []
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. "Common cache root for torchvision.datasets and others." DATASET_CACHE_ROOT = "cached_datasets"
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. """ Shared functions related to testing GPU memory sizes. """ import gc from typing import Tuple import torch def fin...
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # # This source code is licensed under the BSD license found in the # LICENSE file in the root directory of this source tree. from typing import List __all__: List[str] = []