python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
# # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. # # 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 app...
spark-rapids-examples-main
examples/XGBoost-Examples/utility/python/com/nvidia/spark/examples/main.py
spark-rapids-examples-main
examples/XGBoost-Examples/utility/python/com/nvidia/spark/examples/utility/__init__.py
# # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. # # 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 app...
spark-rapids-examples-main
examples/XGBoost-Examples/utility/python/com/nvidia/spark/examples/utility/utils.py
# # Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. # # 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 app...
spark-rapids-examples-main
examples/XGBoost-Examples/utility/python/com/nvidia/spark/examples/utility/args.py
#!/usr/bin/env python # coding: utf-8 # Copyright (c) 2022, NVIDIA Corporation. # # 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 ...
spark-rapids-examples-main
examples/SQL+DF-Examples/customer-churn/notebooks/python/churn/etl.py
# Copyright (c) 2022, NVIDIA Corporation. # # 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...
spark-rapids-examples-main
examples/SQL+DF-Examples/customer-churn/notebooks/python/churn/augment.py
# Copyright (c) 2022, NVIDIA Corporation. # # 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...
spark-rapids-examples-main
examples/SQL+DF-Examples/customer-churn/notebooks/python/churn/eda.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/conftest.py
# Copyright (c) 2022, NVIDIA CORPORATION. # # 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...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/runtests.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/python/conftest.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/python/spark_session.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/python/data_gen.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/python/rapids_udf_test.py
# Copyright (c) 2020-2021, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/python/spark_init_internal.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. # # 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 agre...
spark-rapids-examples-main
examples/UDF-Examples/RAPIDS-accelerated-UDFs/src/main/python/asserts.py
# # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # 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 appl...
spark-rapids-examples-main
examples/UDF-Examples/Spark-cuSpatial/spatial_join.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # 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 applic...
spark-rapids-examples-main
examples/UDF-Examples/Spark-cuSpatial/tools/to_parquet.py
# # Copyright (c) 2021-2021, NVIDIA CORPORATION. All rights reserved. # # 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 app...
spark-rapids-examples-main
examples/ML+DL-Examples/Spark-DL/criteo_train/criteo_keras.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
spark-rapids-examples-main
examples/ML+DL-Examples/Spark-DL/dl_inference/tensorflow/models_config/text_classification/1/model.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
spark-rapids-examples-main
examples/ML+DL-Examples/Spark-DL/dl_inference/tensorflow/models_config/feature_columns/1/model.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
spark-rapids-examples-main
examples/ML+DL-Examples/Spark-DL/dl_inference/huggingface/models_config/hf_transformer/1/model.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
spark-rapids-examples-main
examples/ML+DL-Examples/Spark-DL/dl_inference/huggingface/models_config/hf_generation/1/model.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions a...
spark-rapids-examples-main
examples/ML+DL-Examples/Spark-DL/dl_inference/huggingface/models_config/hf_pipeline/1/model.py
import sys from pyspark.sql import SparkSession from pyspark.sql.functions import * (SparkSession .builder .getOrCreate() .read .csv(sys.argv[1]) .withColumn('_c1', format_string('%.6f', col('_c1').cast('float'))) .withColumn('_c1', when(col('_c1') == '0.000000', lit('0.0')).otherwise(col('_c1...
spark-rapids-examples-main
scripts/encoding-sample/truncate-model.py
# Note: Plase modify the data source options for your case. import sys from pyspark.sql import SparkSession (SparkSession .builder .getOrCreate() .read .option('sep', '\t') .csv(sys.argv[1]) .repartition(int(sys.argv[3])) .write .option('sep', '\t') .option('nullValue', None) ...
spark-rapids-examples-main
scripts/encoding-sample/repartition.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/main.py
spark-rapids-examples-main
scripts/encoding/python/com/__init__.py
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/__init__.py
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/__init__.py
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/__init__.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/main.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/criteo/target_cpu_main.py
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/criteo/__init__.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/criteo/one_hot_cpu_main.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/criteo/common.py
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/utility/__init__.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/utility/utils.py
# # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # 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 applicab...
spark-rapids-examples-main
scripts/encoding/python/com/nvidia/spark/encoding/utility/args.py
from options.train_options import TrainOptions from data.data_loader import CreateDataLoader from models.models import create_model import numpy as np import os opt = TrainOptions().parse() opt.nThreads = 1 opt.batchSize = 1 opt.serial_batches = True opt.no_flip = True opt.instance_feat = True opt.continue_train = T...
pix2pixHD-master
encode_features.py
from options.train_options import TrainOptions from data.data_loader import CreateDataLoader from models.models import create_model import os import util.util as util from torch.autograd import Variable import torch.nn as nn opt = TrainOptions().parse() opt.nThreads = 1 opt.batchSize = 1 opt.serial_batches = True op...
pix2pixHD-master
precompute_feature_maps.py
import os import sys from random import randint import numpy as np import tensorrt try: from PIL import Image import pycuda.driver as cuda import pycuda.gpuarray as gpuarray import pycuda.autoinit import argparse except ImportError as err: sys.stderr.write("""ERROR: failed to import module ({})...
pix2pixHD-master
run_engine.py
import os from collections import OrderedDict from torch.autograd import Variable from options.test_options import TestOptions from data.data_loader import CreateDataLoader from models.models import create_model import util.util as util from util.visualizer import Visualizer from util import html import torch opt = Te...
pix2pixHD-master
test.py
import time import os import numpy as np import torch from torch.autograd import Variable from collections import OrderedDict from subprocess import call import fractions def lcm(a,b): return abs(a * b)/fractions.gcd(a,b) if a and b else 0 from options.train_options import TrainOptions from data.data_loader import Cre...
pix2pixHD-master
train.py
from .base_options import BaseOptions class TestOptions(BaseOptions): def initialize(self): BaseOptions.initialize(self) self.parser.add_argument('--ntest', type=int, default=float("inf"), help='# of test examples.') self.parser.add_argument('--results_dir', type=str, default='./results/', ...
pix2pixHD-master
options/test_options.py
from .base_options import BaseOptions class TrainOptions(BaseOptions): def initialize(self): BaseOptions.initialize(self) # for displays self.parser.add_argument('--display_freq', type=int, default=100, help='frequency of showing training results on screen') self.parser.add_argument...
pix2pixHD-master
options/train_options.py
pix2pixHD-master
options/__init__.py
import argparse import os from util import util import torch class BaseOptions(): def __init__(self): self.parser = argparse.ArgumentParser() self.initialized = False def initialize(self): # experiment specifics self.parser.add_argument('--name', type=str, default='label2ci...
pix2pixHD-master
options/base_options.py
import random import torch from torch.autograd import Variable class ImagePool(): def __init__(self, pool_size): self.pool_size = pool_size if self.pool_size > 0: self.num_imgs = 0 self.images = [] def query(self, images): if self.pool_size == 0: retu...
pix2pixHD-master
util/image_pool.py
from __future__ import print_function import torch import numpy as np from PIL import Image import numpy as np import os # Converts a Tensor into a Numpy array # |imtype|: the desired type of the converted numpy array def tensor2im(image_tensor, imtype=np.uint8, normalize=True): if isinstance(image_tensor, list): ...
pix2pixHD-master
util/util.py
import dominate from dominate.tags import * import os class HTML: def __init__(self, web_dir, title, refresh=0): self.title = title self.web_dir = web_dir self.img_dir = os.path.join(self.web_dir, 'images') if not os.path.exists(self.web_dir): os.makedirs(self.web_dir) ...
pix2pixHD-master
util/html.py
pix2pixHD-master
util/__init__.py
import numpy as np import os import ntpath import time from . import util from . import html import scipy.misc try: from StringIO import StringIO # Python 2.7 except ImportError: from io import BytesIO # Python 3.x class Visualizer(): def __init__(self, opt): # self.opt = opt self....
pix2pixHD-master
util/visualizer.py
import torch def create_model(opt): if opt.model == 'pix2pixHD': from .pix2pixHD_model import Pix2PixHDModel, InferenceModel if opt.isTrain: model = Pix2PixHDModel() else: model = InferenceModel() else: from .ui_model import UIModel model = UIModel() ...
pix2pixHD-master
models/models.py
pix2pixHD-master
models/__init__.py
import torch from torch.autograd import Variable from collections import OrderedDict import numpy as np import os from PIL import Image import util.util as util from .base_model import BaseModel from . import networks class UIModel(BaseModel): def name(self): return 'UIModel' def initialize(self, opt)...
pix2pixHD-master
models/ui_model.py
import os import torch import sys class BaseModel(torch.nn.Module): def name(self): return 'BaseModel' def initialize(self, opt): self.opt = opt self.gpu_ids = opt.gpu_ids self.isTrain = opt.isTrain self.Tensor = torch.cuda.FloatTensor if self.gpu_ids else torch.Tensor ...
pix2pixHD-master
models/base_model.py
import torch import torch.nn as nn import functools from torch.autograd import Variable import numpy as np ############################################################################### # Functions ############################################################################### def weights_init(m): classname = m._...
pix2pixHD-master
models/networks.py
import numpy as np import torch import os from torch.autograd import Variable from util.image_pool import ImagePool from .base_model import BaseModel from . import networks class Pix2PixHDModel(BaseModel): def name(self): return 'Pix2PixHDModel' def init_loss_filter(self, use_gan_feat_loss, use_vg...
pix2pixHD-master
models/pix2pixHD_model.py
import torch.utils.data as data from PIL import Image import torchvision.transforms as transforms import numpy as np import random class BaseDataset(data.Dataset): def __init__(self): super(BaseDataset, self).__init__() def name(self): return 'BaseDataset' def initialize(self, opt): ...
pix2pixHD-master
data/base_dataset.py
def CreateDataLoader(opt): from data.custom_dataset_data_loader import CustomDatasetDataLoader data_loader = CustomDatasetDataLoader() print(data_loader.name()) data_loader.initialize(opt) return data_loader
pix2pixHD-master
data/data_loader.py
class BaseDataLoader(): def __init__(self): pass def initialize(self, opt): self.opt = opt pass def load_data(): return None
pix2pixHD-master
data/base_data_loader.py
pix2pixHD-master
data/__init__.py
############################################################################### # Code from # https://github.com/pytorch/vision/blob/master/torchvision/datasets/folder.py # Modified the original code so that it also loads images from the current # directory as well as the subdirectories ################################...
pix2pixHD-master
data/image_folder.py
import os.path from data.base_dataset import BaseDataset, get_params, get_transform, normalize from data.image_folder import make_dataset from PIL import Image class AlignedDataset(BaseDataset): def initialize(self, opt): self.opt = opt self.root = opt.dataroot ### input A (label maps)...
pix2pixHD-master
data/aligned_dataset.py
import torch.utils.data from data.base_data_loader import BaseDataLoader def CreateDataset(opt): dataset = None from data.aligned_dataset import AlignedDataset dataset = AlignedDataset() print("dataset [%s] was created" % (dataset.name())) dataset.initialize(opt) return dataset class CustomD...
pix2pixHD-master
data/custom_dataset_data_loader.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import sys import os sys.path.append(os.path.join(os.path.dirname(__file__), 'util'))
otk-pyoptix-master
test/conftest.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix import cupy as cp import array import pytest import sample_ptx import tutil if tutil.optix_version_gte( (7,2) ): class TestModuleCom...
otk-pyoptix-master
test/test_module.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix as ox import cupy as cp import array import pytest import sample_ptx import tutil if tutil.optix_version_gte( (7,4) ): class TestProg...
otk-pyoptix-master
test/test_program_group.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. hello_ptx = ''' // // Generated by NVIDIA NVVM Compiler // // Compiler Build ID: CL-29373293 // Cuda compilation tools, release 11.2, V11.2.67 // Based on ...
otk-pyoptix-master
test/sample_ptx.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import cupy as cp import optix as ox import pytest import tutil class Logger: def __init__(self): self.num_mssgs = 0 def __call__(...
otk-pyoptix-master
test/test_context.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix import pytest import cupy as cp import tutil class TestPipeline: def test_pipeline_options( self ): pipeline_options = o...
otk-pyoptix-master
test/test_pipeline.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix import cupy as cp ptx_string_old = ''' // // Generated by NVIDIA NVVM Compiler // // Compiler Build ID: CL-29069683 // Cuda compilation tool...
otk-pyoptix-master
test/util/tutil.py
# Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import os import re import sys import platform import subprocess from setuptools import setup, Extension from setuptools.command.build_ext import build_ext...
otk-pyoptix-master
optix/setup.py
#!/usr/bin/env python3 # Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix import os import cupy as cp # CUDA bindings import numpy as np # Packing of structures in C-compatible format ...
otk-pyoptix-master
examples/hello.py
#!/usr/bin/env python3 # Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix import Imath import OpenEXR import cupy as cp import cupy.cuda.runtime as cuda import numpy as np import ctypes ...
otk-pyoptix-master
examples/denoiser.py
#!/usr/bin/env python3 # # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice,...
otk-pyoptix-master
examples/simpleMotionBlur.py
#!/usr/bin/env python3 # Copyright (c) 2022 NVIDIA CORPORATION All rights reserved. # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. import optix import os import cupy as cp # CUDA bindings import numpy as np # Packing of structures in C-compatible format ...
otk-pyoptix-master
examples/triangle.py
#!/usr/bin/env python3 # # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice,...
otk-pyoptix-master
examples/curves.py
#!/usr/bin/env python3 # # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # * Redistributions of source code must retain the above copyright # notice,...
otk-pyoptix-master
examples/sphere.py
# Use this file to bootstrap packman into your Python environment (3.7.x). Simply # add the path by doing sys.insert to where packmanconf.py is located and then execute: # # >>> import packmanconf # >>> packmanconf.init() # # It will use the configured remote(s) and the version of packman in the same folder, # giving y...
cccl-main
cub/docs/tools/packman/packmanconf.py
# Copyright 2019 NVIDIA CORPORATION # 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 writi...
cccl-main
cub/docs/tools/packman/bootstrap/install_package.py
import os import sys import io import contextlib import packmanapi REPO_ROOT = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../..") REPO_DEPS_FILE = os.path.join(REPO_ROOT, "deps/repo-deps.packman.xml") def bootstrap(): """ Bootstrap all omni.repo modules. Pull with packman from repo.packm...
cccl-main
cub/docs/tools/repoman/repoman.py
#!/usr/bin/env python import hpccm hpccm.config.set_container_format('docker') Stage0 += hpccm.primitives.baseimage(image='nvidia/cuda:12.2.0-devel-ubuntu22.04') Stage0 += hpccm.building_blocks.apt_get(ospackages=['git', 'tmux', 'gcc', 'g++', 'vim', 'python3', 'python-is-python3', 'ninja-build']) # Stage0 += hpccm.b...
cccl-main
cub/benchmarks/docker/recipe.py
#!/usr/bin/env python3 import cub.bench as bench # TODO: # - driver version # - host compiler + version # - gpu clocks / pm # - ecc def main(): center_estimator = bench.MedianCenterEstimator() bench.search(bench.BruteForceSeeker(center_estimator, center_estimator)) if __name__ == "__main__": main()
cccl-main
cub/benchmarks/scripts/search.py
#!/usr/bin/env python3 import sys import argparse import cub.bench def parse_arguments(): parser = argparse.ArgumentParser(description='Verify tuning variant') parser.add_argument('--variant', type=str, help='Variant to verify', default=None, required=True) variant = parser.parse_known_args()[0].varian...
cccl-main
cub/benchmarks/scripts/verify.py
#!/usr/bin/env python3 import os import re import cub import math import argparse import itertools import functools import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.stats import mannwhitneyu from scipy.stats.mstats import hdquantiles pd.options.display.max_colwidth = 100 default_colo...
cccl-main
cub/benchmarks/scripts/analyze.py
from . import bench
cccl-main
cub/benchmarks/scripts/cub/__init__.py
class Build: def __init__(self, code, elapsed): self.code = code self.elapsed = elapsed def __repr__(self): return "Build(code = {}, elapsed = {:.4f}s)".format(self.code, self.elapsed)
cccl-main
cub/benchmarks/scripts/cub/bench/build.py
import os import sys import random import itertools def randomized_cartesian_product(list_of_lists): length = 1 for l in list_of_lists: length *= len(l) visited = set() while len(visited) < length: variant = tuple(map(random.choice, list_of_lists)) if variant not in visited: ...
cccl-main
cub/benchmarks/scripts/cub/bench/config.py
import os import time import signal import subprocess from .build import Build from .config import Config from .storage import Storage from .logger import * def create_builds_table(conn): with conn: conn.execute(""" CREATE TABLE IF NOT EXISTS builds ( ctk TEXT NOT NULL, cu...
cccl-main
cub/benchmarks/scripts/cub/bench/cmake.py
from .config import * from .storage import * from .bench import Bench from .cmake import CMake from .score import * from .search import *
cccl-main
cub/benchmarks/scripts/cub/bench/__init__.py
import logging class Logger: _instance = None def __new__(cls, *args, **kwargs): if cls._instance is None: cls._instance = super().__new__(cls, *args, **kwargs) logger = logging.getLogger() logger.setLevel(logging.DEBUG) file_handler = logging.FileHandle...
cccl-main
cub/benchmarks/scripts/cub/bench/logger.py
import os import json import time import fpzip import signal import itertools import subprocess import numpy as np from .cmake import CMake from .config import * from .storage import Storage, get_bench_table_name from .score import * from .logger import * def first_val(my_dict): values = list(my_dict.values()) ...
cccl-main
cub/benchmarks/scripts/cub/bench/bench.py
import os import fpzip import sqlite3 import numpy as np import pandas as pd db_name = "cub_bench_meta.db" def get_bench_table_name(subbench, algname): return "{}.{}".format(algname, subbench) def blob_to_samples(blob): return np.squeeze(fpzip.decompress(blob)) class StorageBase: def __init__(self, ...
cccl-main
cub/benchmarks/scripts/cub/bench/storage.py
import re import argparse import numpy as np from .bench import Bench, BaseBench from .config import Config from .storage import Storage from .cmake import CMake def list_benches(): print("### Benchmarks") config = Config() for algname in config.benchmarks: space_size = config.variant_space_siz...
cccl-main
cub/benchmarks/scripts/cub/bench/search.py
import math import numpy as np def importance_function(x): return 1 - math.exp(-x) def x_by_importance(y): return -math.log(1 - y) def compute_weights(num_values): least_importance = 0.6 most_importance = 0.999 assert(least_importance < most_importance) assert(least_importance >= 0 and le...
cccl-main
cub/benchmarks/scripts/cub/bench/score.py
#!/usr/bin/env python # Generate set of projects mk files. # Usage: python generate_mk.py PROJECTS_MK_DIR THRUST_SOURCE_DIR # The program scans through unit tests and examples in THRUST_SOURCE_DIR # and generates project mk for each of the tests and examples in PROJECTS_MK_DIR # A single example or unit test so...
cccl-main
thrust/generate_mk.py
#! /usr/bin/env python # Copyright (c) 2022 NVIDIA Corporation # Reply-To: Allison Vacanti <alliepiper16@gmail.com> # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # Released under the Apache License v2.0 with LLVM Exceptions. # See https://llvm.org/LICENSE.txt for license information. help_text = """%(prog...
cccl-main
thrust/ci/common/memmon.py
#! /usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright (c) 2012-7 Bryce Adelstein Lelbach aka wash <brycelelbach@gmail.com> # # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy...
cccl-main
thrust/internal/benchmark/combine_benchmark_results.py
#! /usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright (c) 2012-7 Bryce Adelstein Lelbach aka wash <brycelelbach@gmail.com> # # Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy...
cccl-main
thrust/internal/benchmark/compare_benchmark_results.py