python_code stringlengths 0 679k | repo_name stringlengths 9 41 | file_path stringlengths 6 149 |
|---|---|---|
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_copy.py |
import warp as wp
import numpy as np
import unittest
import warp as wp
from warp.tests.test_base import *
wp.init()
@wp.kernel
def test_pow(x: float, e: float, result: float):
tid = wp.tid()
y = wp.pow(-2.0, e)
wp.expect_eq(y, result)
def test_fast_math(test, device):
# on all systems pow() sh... | warp-main | warp/tests/test_fast_math.py |
import numpy as np
import math
import warp as wp
from warp.tests.test_base import *
wp.init()
np_float_types = [np.float32, np.float64, np.float16]
kernel_cache = dict()
def getkernel(func, suffix=""):
module = wp.get_module(func.__module__)
key = func.__name__ + "_" + suffix
if key not in kernel_cach... | warp-main | warp/tests/test_spatial.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_mesh_query_ray.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_hash_grid.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_operators.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_tape.py |
warp-main | warp/tests/__init__.py | |
import numpy as np
import warp as wp
from warp.utils import runlength_encode
from warp.tests.test_base import *
wp.init()
def test_runlength_encode_int(test, device):
n = 1000
values_np = np.sort(np.random.randint(-10, 10, n, dtype=int))
unique_values_np, unique_counts_np = np.unique(values_np, return... | warp-main | warp/tests/test_runlength_encode.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_struct.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_ctypes.py |
import numpy as np
import warp as wp
from warp.tests.test_base import *
wp.init()
TRUE_CONSTANT = wp.constant(True)
@wp.func
def identity_function(input_bool: wp.bool, plain_bool: bool):
return input_bool and plain_bool
@wp.kernel
def identity_test(data: wp.array(dtype=wp.bool)):
i = wp.tid()
data[i... | warp-main | warp/tests/test_bool.py |
import unittest
import numpy as np
import warp as wp
from warp.tests.test_base import *
wp.init()
@wp.kernel
def load_store_half(f32: wp.array(dtype=wp.float32), f16: wp.array(dtype=wp.float16)):
tid = wp.tid()
# check conversion from f32->f16
a = wp.float16(f32[tid])
b = f16[tid]
wp.expect_e... | warp-main | warp/tests/test_fp16.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_compile_consts.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_import.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_conditional.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_adam.py |
import warp as wp
@wp.kernel
def unresolved_func_kernel():
# this should trigger an exception due to unresolved function
x = wp.missing_func(42)
| warp-main | warp/tests/test_unresolved_func.py |
import numpy as np
import unittest
import warp as wp
from warp.tests.test_base import *
np.random.seed(0)
wp.init()
wp.config.mode = "debug"
class GemmTestbedRunner:
def __init__(self, dtype, device):
self.dtype = dtype
self.device = device
def alloc(self, m, n, k, batch_count):
lo... | warp-main | warp/tests/test_matmul.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_multigpu.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_dependent.py |
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_generics.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_fem.py |
import numpy as np
import os
import warp as wp
from warp.tests.test_base import *
wp.init()
np_float_types = [np.float32, np.float64, np.float16]
kernel_cache = dict()
def getkernel(func, suffix=""):
module = wp.get_module(func.__module__)
key = func.__name__ + "_" + suffix
if key not in kernel_cache:... | warp-main | warp/tests/test_quat.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_rand.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_mesh_query_aabb.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_transient_module.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_reload.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_pinned.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_func.py |
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_dlpack.py |
import numpy as np
import math
import warp as wp
from warp.tests.test_base import *
import unittest
wp.init()
@wp.kernel
def eval_dense_gemm(
m: int,
n: int,
p: int,
t1: int,
t2: int,
A: wp.array(dtype=float),
B: wp.array(dtype=float),
C: wp.array(dtype=float),
):
wp.dense_gemm(... | warp-main | warp/tests/test_dense.py |
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_indexedarray.py |
import warp as wp
@wp.kernel
def unresolved_symbol_kernel():
# this should trigger an exception due to unresolved symbol
x = missing_symbol
| warp-main | warp/tests/test_unresolved_symbol.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_mat.py |
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_fabricarray.py |
# This file is used to test reloading module references.
import warp as wp
wp.init()
@wp.func
def more_magic():
return 2.0
| warp-main | warp/tests/test_reference_reference.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_arithmetic.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_base.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_mesh_query_point.py |
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import warp as wp
import numpy as np
wp.config.mode = "release"
wp.config.verbose = True
wp.config.verify_cuda = True
wp.init()
n = 100000
num_runs = 16
def test_for_type(dtype, device):
dtype_str = dtype.... | warp-main | warp/tests/test_array_scan.py |
from .test_all import run
ret = run()
import sys
sys.exit(ret)
| warp-main | warp/tests/__main__.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_grad.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_smoothstep.py |
# Copyright (c) 2023 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_math.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/tests/test_codegen.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/render/render_usd.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/render/__init__.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/render/utils.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/render/render_opengl.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/optim/sgd.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/optim/__init__.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/optim/adam.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/integrator_euler.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/import_mjcf.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/render.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/integrator_xpbd.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/inertia.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/__init__.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/import_urdf.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/collide.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/particles.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/model.py |
import warp as wp
PI = wp.constant(3.14159265359)
PI_2 = wp.constant(1.57079632679)
@wp.func
def velocity_at_point(qd: wp.spatial_vector, r: wp.vec3):
"""
Returns the velocity of a point relative to the frame with the given spatial velocity.
"""
return wp.cross(wp.spatial_top(qd), r) + wp.spatial_bot... | warp-main | warp/sim/utils.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/optimizer.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/import_snu.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/import_usd.py |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | warp-main | warp/sim/articulation.py |
import ctypes
_c_str_dltensor = b"dltensor"
class DLDeviceType(ctypes.c_int):
"""The enum that encodes the type of the device where
DLTensor memory is allocated.
"""
kDLCPU = 1
kDLCUDA = 2
kDLCUDAHost = 3
kDLOpenCL = 4
kDLVulkan = 7
kDLMetal = 8
kDLVPI = 9
kDLROCM = 10
... | warp-main | warp/thirdparty/dlpack.py |
warp-main | warp/thirdparty/__init__.py | |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2005-2010 ActiveState Software Inc.
# Copyright (c) 2013 Eddy Petrișor
"""Utilities for determining application-specific dirs.
See <http://github.com/ActiveState/appdirs> for details and usage.
"""
# Dev Notes:
# - MSDN on where to store app data files:
# ... | warp-main | warp/thirdparty/appdirs.py |
#!/usr/bin/python3
#
# Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# ... | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/ncu/apsm/cpp/lib/binary/converter.py |
from conans import ConanFile
class ArgparseConan(ConanFile):
name = "argparse"
version = "1.0"
exports_sources = "include/argparse.hpp"
no_copy_source = True
def package(self):
self.copy("argparse.hpp") | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/ncu/apsm/cpp/external/argparse/conanfile.py |
# BSD 3-Clause License
#
# Copyright (c) 2021, NVIDIA CORPORATION
# Copyright (c) 2017,
# 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 ... | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/nsys/application/main_baseline.py |
# BSD 3-Clause License
#
# Copyright (c) 2021, NVIDIA CORPORATION
# Copyright (c) 2017,
# 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 ... | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/nsys/application/main_opt2.py |
# BSD 3-Clause License
#
# Copyright (c) 2021, NVIDIA CORPORATION
# Copyright (c) 2017,
# 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 ... | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/nsys/application/main_opt3.py |
# BSD 3-Clause License
#
# Copyright (c) 2021, NVIDIA CORPORATION
# Copyright (c) 2017,
# 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 ... | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/nsys/application/main_opt1.py |
# BSD 3-Clause License
#
# Copyright (c) 2021, NVIDIA CORPORATION
# Copyright (c) 2017,
# 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 ... | nsight-training-master | cuda/2021_gtc/x-ac-03-v1/task1/task/nsys/application/main_baseline_nvtx.py |
#!/usr/bin/python
import argparse
import os
import shutil
import sys
skipped_steps = [2]
class SourceFile:
def __init__(self, src, dst_name=None):
self.src = src
self.dst_name = dst_name
def copy(self, dst, step):
if not os.path.isfile(self.src):
print("Failed to find src... | nsight-training-master | cuda/2020_gtc/projects/generate_nsightee_projects.py |
##Basic mcq
from ipywidgets import widgets, Layout, Box, GridspecLayout
def create_multipleChoice_widget(description, options, correct_answer, tip):
if correct_answer not in options:
options.append(correct_answer)
correct_answer_index = options.index(correct_answer)
radio_options = [(wor... | nsight-training-master | grfx/2021_gtc/x-gd-01-v1/task1/lab/task/graphics/mcq.py |
#!/usr/bin/python
import ctypes
from cuda import cudart
from datetime import datetime as dt
from glob import glob
import numpy as np
import os
import sys
import tensorrt as trt
from calibrator import DecoderCalibrator
basePath = "./"
onnxFile = sorted(glob(basePath + "decoderV*.onnx"))[-1]
trtFile = basePath + "decod... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/decoder.py |
from collections import OrderedDict
from copy import deepcopy
import numpy as np
import onnx
import onnx_graphsurgeon as gs
onnxFilePath = "/workspace/"
#onnxFilePath = "./" # local host
sourceOnnx = "./decoderV2.onnx"
destinationOnnx = "./decoderV3.onnx"
bConvertToStaticNetwork = False
bDebug = False
nWili = 0
bNot... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/decoder-surgeonV3.py |
from collections import OrderedDict
from copy import deepcopy
import numpy as np
import onnx
import onnx_graphsurgeon as gs
sourceOnnx = "./encoderV2.onnx"
destinationOnnx = "./encoderV3.onnx"
bConvertToStaticNetwork = False
debugNodeList = []
nWili = 0
bSimplifyOutput = True
bNotV3 = True
nNotV3 = 0
bLayerNormPlugi... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/encoder-surgeonV6.py |
#!/usr/bin/python
import ctypes
from cuda import cudart
from datetime import datetime as dt
from glob import glob
import numpy as np
import os
import sys
import tensorrt as trt
from calibrator import EncoderCalibrator
#basePath = "/target/"
basePath = "./"
onnxFile = sorted(glob(basePath + "encoderV*.onnx"))[-1]
t... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/encoder.py |
import os
import numpy as np
from cuda import cudart
import tensorrt as trt
class EncoderCalibrator(trt.IInt8EntropyCalibrator2):
def __init__(self, npzFile, cacheFile, nBS, nSL): # BatchSize,SequenceLength,Calibration
trt.IInt8EntropyCalibrator2.__init__(self)
self.data = np.load(npzFile)
... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/calibrator.py |
from collections import OrderedDict
from copy import deepcopy
import numpy as np
import onnx
import onnx_graphsurgeon as gs
sourceOnnx = "./encoderV2.onnx"
destinationOnnx = "./encoderV3.onnx"
bConvertToStaticNetwork = False
debugNodeList = []
nWili = 0
bSimplifyOutput = True
bNot = False
nNot = 0
bNotV2 = True
nNot... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/encoder-surgeonV5.py |
#!/usr/bin/python
import numpy as np
np.random.seed(97)
for bs in [1, 4, 16, 64]:
for sl in [16, 64, 256, 1024]:
fileName = "./data/encoder-%d-%d.npz" % (bs, sl)
data = {}
data['speech'] = np.random.rand(bs * sl * 80).astype(np.float32).reshape(bs, sl, 80) * 2 - 1
data['speech_len... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/createFakeIOData.py |
#!/usr/bin/python
import os
import sys
import ctypes
import numpy as np
from glob import glob
from time import time_ns
from datetime import datetime as dt
from cuda import cudart
import tensorrt as trt
dataFilePath = "./data/"
planFilePath = ""
encoderPlanFile = planFilePath + "encoder.plan"
encoderScoreFile = planFi... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/testEncoderAndDecoder.py |
import os
import ctypes
import numpy as np
#from time import time_ns
import tensorrt as trt
import pycuda.autoinit
import pycuda.driver as cuda
useFile = False
ipnutDataFile = '/workspace/data/encoder-16-64.npz'
soFilePath = './Mask.so'
epsilon = 1e-6
negInf = -6e6
np.random.seed(97)
... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/MaskPlugin-1output/testMaskPlugin.py |
import os
import ctypes
import numpy as np
#from time import time_ns
import tensorrt as trt
import pycuda.autoinit
import pycuda.driver as cuda
useFile = False
ipnutDataFile = '/workspace/data/encoder-16-64.npz'
soFilePath = './Mask.so'
epsilon = 1e-6
negInf = -6e6
np.random.seed(97)
... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/MaskPlugin-2output/testMaskPlugin.py |
import os
import ctypes
import numpy as np
from time import time_ns
import tensorrt as trt
import pycuda.autoinit
import pycuda.driver as cuda
useFile = False
ipnutDataFile = './layerNormIO-bs64.npz'
soFilePath = './LayerNorm.so'
nBS = 1024
nSL = 256
nEmbedding = 256
nTime ... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/LayerNormPlugin/testLayerNormPlugin.py |
import os
import ctypes
from glob import glob
from time import time
import numpy as np
import tensorrt as trt
import pycuda.autoinit
import pycuda.driver as cuda
useDataFromFile = True
ipnutDataFile = './output.npz'
parameterFile = './para.npz'
soFilePath = './Attention.so'
nTime = 30
nHead ... | trt-samples-for-hackathon-cn-master | Hackathon2022/code/AttentionPlugin/testAttentionPlugin.py |
from share import *
import config
import cv2
import einops
import gradio as gr
import numpy as np
import torch
import random
from pytorch_lightning import seed_everything
from annotator.util import resize_image, HWC3
from annotator.mlsd import MLSDdetector
from cldm.model import create_model, load_state_dict
from cld... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/gradio_hough2image.py |
path_sd15 = './models/v1-5-pruned.ckpt'
path_sd15_with_control = './models/control_sd15_openpose.pth'
path_input = './models/anything-v3-full.safetensors'
path_output = './models/control_any3_openpose.pth'
import os
assert os.path.exists(path_sd15), 'Input path_sd15 does not exists!'
assert os.path.exists(path_sd15... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/tool_transfer_control.py |
save_memory = False
| trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/config.py |
from share import *
import config
import cv2
import einops
import gradio as gr
import numpy as np
import torch
import random
from pytorch_lightning import seed_everything
from annotator.util import resize_image, HWC3
from annotator.midas import MidasDetector
from cldm.model import create_model, load_state_dict
from c... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/gradio_depth2image.py |
from share import *
import config
import cv2
import einops
import gradio as gr
import numpy as np
import torch
import random
import os
import tensorrt as trt
from pytorch_lightning import seed_everything
from annotator.util import resize_image, HWC3
from annotator.canny import CannyDetector
from cldm.model import cre... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/canny2image_TRT.py |
import sys
import os
assert len(sys.argv) == 3, 'Args are wrong.'
input_path = sys.argv[1]
output_path = sys.argv[2]
assert os.path.exists(input_path), 'Input model does not exist.'
assert not os.path.exists(output_path), 'Output filename already exists.'
assert os.path.exists(os.path.dirname(output_path)), 'Output ... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/tool_add_control_sd21.py |
from share import *
import config
import cv2
import einops
import gradio as gr
import numpy as np
import torch
import random
from pytorch_lightning import seed_everything
from annotator.util import resize_image, HWC3
from annotator.uniformer import UniformerDetector
from cldm.model import create_model, load_state_dic... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/gradio_seg2image.py |
import numpy as np
from pytorch_fid import fid_score
from pytorch_fid.inception import InceptionV3
import cv2
import datetime
from canny2image_TRT import hackathon
block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[2048]
model = InceptionV3([block_idx]).to("cuda")
def PD(base_img, new_img):
inception_feature_ref, _ = fid... | trt-samples-for-hackathon-cn-master | Hackathon2023/controlnet/compute_score.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.