python_code stringlengths 0 679k | repo_name stringlengths 9 41 | file_path stringlengths 6 149 |
|---|---|---|
################################################################################
#
# Copyright (c) 2017 - 2022 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 t... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/frontend.py |
import re
def SubstituteTemplate(template, values):
text = template
changed = True
while changed:
changed = False
for key, value in values.items():
regex = "\\$\\{%s\\}" % key
newtext = re.sub(regex, value, text)
if newtext != text:
chang... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/__init__.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 t... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/conv2d_operation.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/tensor_ref.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 t... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/operation.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/parser.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 t... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/epilogue.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_grouped_testbed.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/conv2d_testbed.py |
from pycutlass.test.profiler import *
from pycutlass.test.conv2d_testbed import *
from pycutlass.test.gemm_testbed import *
from pycutlass.test.gemm_grouped_testbed import *
| warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/__init__.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/gemm_testbed.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/test/profiler.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/device.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/reference_model.py |
from pycutlass.utils.reference_model import *
| warp-main | warp/native/cutlass/tools/library/scripts/pycutlass/src/pycutlass/utils/__init__.py |
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/test/unit/gemm/device/simt_sm50.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_all_code.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_device.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_kernel.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_threadblock.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_customized_epilogue.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_cmake.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_verify.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/helper.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_turing_and_volta.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_sample.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/replace_fix_impl_header.py |
#################################################################################################
#
# Copyright (c) 2017 - 2022 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... | warp-main | warp/native/cutlass/examples/44_multi_gemm_ir_and_codegen/ir_gen/gen_ir.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/examples/40_cutlass_py/gemm.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/examples/40_cutlass_py/conv2d.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/examples/40_cutlass_py/gemm_grouped.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/examples/40_cutlass_py/customizable/gemm.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/examples/40_cutlass_py/customizable/conv2d.py |
################################################################################
#
# Copyright (c) 2017 - 2022 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 ... | warp-main | warp/native/cutlass/examples/40_cutlass_py/customizable/gemm_grouped.py |
from typing import Any, Optional
import warp as wp
from warp.types import type_length, type_is_matrix
from warp.sparse import BsrMatrix, bsr_copy, bsr_mv, bsr_mm, bsr_assign, bsr_axpy
from .utils import array_axpy
def normalize_dirichlet_projector(projector_matrix: BsrMatrix, fixed_value: Optional[wp.array] = None... | warp-main | warp/fem/dirichlet.py |
from typing import Union
from enum import Enum
import warp as wp
import warp.codegen
import warp.context
from warp.fem.geometry import (
Element,
Geometry,
GeometryPartition,
WholeGeometryPartition,
)
GeometryOrPartition = Union[Geometry, GeometryPartition]
class GeometryDomain:
"""Interface cl... | warp-main | warp/fem/domain.py |
import inspect
from typing import Callable, Any
import warp as wp
from warp.fem.types import Domain, Field, Sample
from warp.fem import utils
class Integrand:
"""An integrand is a device function containing arbitrary expressions over Field and Domain variables.
It will get transformed to a proper warp.Funct... | warp-main | warp/fem/operator.py |
from typing import Callable, Optional
import warp as wp
from warp.fem.operator import Integrand
import re
_kernel_cache = dict()
_struct_cache = dict()
_func_cache = dict()
_key_re = re.compile("[^0-9a-zA-Z_]+")
def get_func(func, suffix=""):
key = f"{func.__name__}_{suffix}"
key = _key_re.sub("", key)
... | warp-main | warp/fem/cache.py |
# Shared DOFs : vertices or edges (sides in 3D)
# DG: Interior DOFs only
# Unique identifier -> vertex or edge, side
# Element -> DOF id
| warp-main | warp/fem/__init__.py |
import warp as wp
vec1i = wp.types.vector(length=1, dtype=wp.int32)
vec2i = wp.types.vector(length=2, dtype=wp.int32)
vec3i = wp.types.vector(length=3, dtype=wp.int32)
vec4i = wp.types.vector(length=4, dtype=wp.int32)
vec8i = wp.types.vector(length=8, dtype=wp.int32)
vec6 = wp.types.vector(length=6, dtype=wp.float32... | warp-main | warp/fem/types.py |
from typing import List, Dict, Set, Optional, Any, Union
import warp as wp
import re
import ast
from warp.sparse import BsrMatrix, bsr_zeros, bsr_set_from_triplets, bsr_copy, bsr_diag
from warp.types import type_length
from warp.utils import array_cast
from warp.codegen import get_annotations
from warp.fem.domain i... | warp-main | warp/fem/integrate.py |
from typing import Any, Tuple
import warp as wp
from warp.utils import radix_sort_pairs, runlength_encode, array_scan
from .types import vec6
@wp.func
def generalized_outer(x: Any, y: wp.vec2):
return wp.outer(x, y)
@wp.func
def generalized_outer(x: Any, y: wp.vec3):
return wp.outer(x, y)
@wp.func
def g... | warp-main | warp/fem/utils.py |
import math
from enum import Enum
import numpy as np
class Polynomial(Enum):
GAUSS_LEGENDRE = 0
LOBATTO_GAUSS_LEGENDRE = 1
EQUISPACED_CLOSED = 2
EQUISPACED_OPEN = 3
def is_closed(family: Polynomial):
"""Whether the polynomial roots include interval endpoints"""
return family == Polynomial.L... | warp-main | warp/fem/polynomial.py |
from typing import Any
import warp as wp
from warp.fem import domain
from warp.fem.types import ElementIndex, Coords
from ..polynomial import Polynomial
class Quadrature:
"""Interface class for quadrature rules"""
Arg: wp.codegen.Struct
"""Structure containing arguments to be passed to device function... | warp-main | warp/fem/quadrature/quadrature.py |
from .quadrature import Quadrature, RegularQuadrature
from .pic_quadrature import PicQuadrature
| warp-main | warp/fem/quadrature/__init__.py |
import warp as wp
from warp.fem.domain import GeometryDomain
from warp.fem.types import ElementIndex, Coords
from warp.fem.utils import compress_node_indices
from .quadrature import Quadrature
wp.set_module_options({"enable_backward": False})
class PicQuadrature(Quadrature):
"""Particle-based quadrature formu... | warp-main | warp/fem/quadrature/pic_quadrature.py |
import warp as wp
from warp.fem.domain import GeometryDomain
from warp.fem.space import FunctionSpace, SpacePartition
from warp.fem.types import Sample, get_node_index_in_element
from warp.fem import utils, cache
class TrialField:
"""Field defined over a domain that can be used as a trial function"""
def __i... | warp-main | warp/fem/field/trial.py |
from typing import Union, Optional
from warp.fem.domain import GeometryDomain, Cells
from warp.fem.space import FunctionSpace, SpaceRestriction, SpacePartition, make_space_partition, make_space_restriction
from .discrete_field import DiscreteField
from .restriction import FieldRestriction
from .test import TestField
... | warp-main | warp/fem/field/__init__.py |
import warp as wp
from warp.fem.space import SpaceRestriction, FunctionSpace
from warp.fem.types import Sample, get_node_index_in_element
from warp.fem import utils, cache
class TestField:
"""Field defined over a space restriction that can be used as a test function"""
def __init__(self, space_restriction: ... | warp-main | warp/fem/field/test.py |
from typing import Any
import warp as wp
from warp.fem.types import Sample
from warp.fem.space import FunctionSpace, SpacePartition
class DiscreteField:
"""Field defined over a partition of a discrete function space"""
EvalArg: wp.codegen.Struct
"""Structure containing arguments passed to device functi... | warp-main | warp/fem/field/discrete_field.py |
from warp.fem.space import SpaceRestriction
from .discrete_field import DiscreteField
class FieldRestriction:
"""Restriction of a space to a given GeometryDomain"""
def __init__(self, space_restriction: SpaceRestriction, field: DiscreteField):
if field.space.DIMENSION - 1 == space_restriction.space.... | warp-main | warp/fem/field/restriction.py |
import warp as wp
from warp.fem.space import NodalFunctionSpace, SpacePartition
from warp.fem import cache, utils
from warp.fem.types import Sample, ElementIndex, NULL_NODE_INDEX
from .discrete_field import DiscreteField
class NodalField(DiscreteField):
def __init__(self, space_partition: SpacePartition, space:... | warp-main | warp/fem/field/nodal_field.py |
from typing import Any
import warp as wp
from warp.fem.types import ElementIndex, NULL_ELEMENT_INDEX
from warp.fem.utils import masked_indices
from .geometry import Geometry
wp.set_module_options({"enable_backward": False})
class GeometryPartition:
"""Base class for geometry partitions, i.e. subset of cells... | warp-main | warp/fem/geometry/partition.py |
import warp as wp
from warp.fem.types import ElementIndex, Coords, vec2i, Sample, NULL_QP_INDEX, NULL_DOF_INDEX
from .geometry import Geometry
from .element import Square, LinearEdge
@wp.struct
class Grid2DCellArg:
res: vec2i
cell_size: wp.vec2
origin: wp.vec2
class Grid2D(Geometry):
"""Two-dimens... | warp-main | warp/fem/geometry/grid_2d.py |
from .element import Element
from .geometry import Geometry
from .partition import (
GeometryPartition,
WholeGeometryPartition,
LinearGeometryPartition,
ExplicitGeometryPartition,
)
from .grid_2d import Grid2D
from .grid_3d import Grid3D
from .trimesh_2d import Trimesh2D
from .tetmesh import Tetmesh | warp-main | warp/fem/geometry/__init__.py |
import warp as wp
from warp.fem.types import ElementIndex, Coords, Sample, NULL_QP_INDEX, NULL_DOF_INDEX
from warp.fem.types import vec2i, vec3i
from .geometry import Geometry
from .element import Square, Cube
@wp.struct
class Grid3DCellArg:
res: vec3i
cell_size: wp.vec3
origin: wp.vec3
class Grid3D(G... | warp-main | warp/fem/geometry/grid_3d.py |
from typing import Tuple, List
from warp.fem.types import Coords
from warp.fem.polynomial import Polynomial, quadrature_1d
class Element:
@staticmethod
def instantiate_quadrature(order: int, family: Polynomial) -> Tuple[List[Coords], List[float]]:
"""Returns a quadrature of a given order for a protot... | warp-main | warp/fem/geometry/element.py |
from typing import Any
import warp as wp
from warp.fem.types import Coords
@wp.func
def project_on_seg_at_origin(q: Any, seg: Any, len_sq: float):
s = wp.clamp(wp.dot(q, seg) / len_sq, 0.0, 1.0)
return wp.length_sq(q - s * seg), s
@wp.func
def project_on_tri_at_origin(q: Any, e1: Any, e2: Any):
e1e1 =... | warp-main | warp/fem/geometry/closest_point.py |
import warp as wp
from warp.fem.types import ElementIndex, Coords, vec2i, Sample
from warp.fem.types import NULL_ELEMENT_INDEX, OUTSIDE, NULL_DOF_INDEX, NULL_QP_INDEX
from .geometry import Geometry
from .element import Triangle, LinearEdge
from .closest_point import project_on_tri_at_origin
@wp.struct
class Trimesh... | warp-main | warp/fem/geometry/trimesh_2d.py |
import warp as wp
from warp.fem.types import ElementIndex, Coords, vec2i, vec3i, Sample
from warp.fem.types import NULL_ELEMENT_INDEX, OUTSIDE, NULL_DOF_INDEX, NULL_QP_INDEX
from .geometry import Geometry
from .element import Triangle, Tetrahedron
from .closest_point import project_on_tet_at_origin
@wp.struct
class... | warp-main | warp/fem/geometry/tetmesh.py |
from typing import Any
import warp as wp
from warp.fem.types import Sample, ElementIndex, Coords
from .element import Element
class Geometry:
"""
Interface class for discrete geometries
A geometry is composed of cells and sides. Sides may be boundary or interior (between cells).
"""
dimension:... | warp-main | warp/fem/geometry/geometry.py |
import warp as wp
import numpy as np
from warp.fem.types import ElementIndex, Coords, OUTSIDE
from warp.fem.types import vec2i, vec3i
from warp.fem.polynomial import Polynomial, lagrange_scales, quadrature_1d, is_closed
from warp.fem.geometry import Grid3D
from .dof_mapper import DofMapper
from .nodal_function_space... | warp-main | warp/fem/space/grid_3d_function_space.py |
from typing import Any
import warp as wp
from warp.fem.types import DofIndex, ElementIndex, Coords, get_node_coord
from warp.fem.geometry import GeometryPartition
from warp.fem import utils
from .function_space import FunctionSpace
from .dof_mapper import DofMapper, IdentityMapper
from .partition import make_space_... | warp-main | warp/fem/space/nodal_function_space.py |
from typing import Any, Optional
import warp as wp
from warp.fem.geometry import GeometryPartition, WholeGeometryPartition
from warp.fem.utils import compress_node_indices, _iota_kernel
from warp.fem.types import NULL_NODE_INDEX
from .function_space import FunctionSpace
wp.set_module_options({"enable_backward": Fa... | warp-main | warp/fem/space/partition.py |
import warp as wp
import numpy as np
from warp.fem.types import ElementIndex, Coords, OUTSIDE, vec2i, vec3i
from warp.fem.geometry import Trimesh2D
from .dof_mapper import DofMapper
from .nodal_function_space import NodalFunctionSpace, NodalFunctionSpaceTrace
class Trimesh2DFunctionSpace(NodalFunctionSpace):
D... | warp-main | warp/fem/space/trimesh_2d_function_space.py |
from typing import Optional
import warp.fem.domain
import warp.fem.geometry
import warp.fem.polynomial
from .function_space import FunctionSpace
from .nodal_function_space import NodalFunctionSpace
from .grid_2d_function_space import (
GridPiecewiseConstantSpace,
GridBipolynomialSpace,
GridDGBipolynomial... | warp-main | warp/fem/space/__init__.py |
from typing import Any
from enum import Enum
import math
import warp as wp
import warp.types
from warp.fem.types import vec6
_SQRT_2 = wp.constant(math.sqrt(2.0))
_SQRT_3 = wp.constant(math.sqrt(3.0))
_SQRT_1_2 = wp.constant(math.sqrt(1.0 / 2.0))
_SQRT_1_3 = wp.constant(math.sqrt(1.0 / 3.0))
class DofMapper:
"... | warp-main | warp/fem/space/dof_mapper.py |
import warp as wp
from warp.fem.domain import GeometryDomain
from warp.fem.types import NodeElementIndex
from warp.fem.utils import compress_node_indices
from .function_space import FunctionSpace
from .partition import SpacePartition
wp.set_module_options({"enable_backward": False})
class SpaceRestriction:
"""... | warp-main | warp/fem/space/restriction.py |
import warp as wp
import numpy as np
from warp.fem.types import ElementIndex, Coords, OUTSIDE, vec2i, vec3i, vec4i
from warp.fem.geometry import Tetmesh
from .dof_mapper import DofMapper
from .nodal_function_space import NodalFunctionSpace, NodalFunctionSpaceTrace
class TetmeshFunctionSpace(NodalFunctionSpace):
... | warp-main | warp/fem/space/tetmesh_function_space.py |
import warp as wp
import numpy as np
from warp.fem.types import ElementIndex, Coords, OUTSIDE
from warp.fem.types import vec2i
from warp.fem.polynomial import Polynomial, lagrange_scales, quadrature_1d, is_closed
from warp.fem.geometry import Grid2D
from .dof_mapper import DofMapper
from .nodal_function_space import... | warp-main | warp/fem/space/grid_2d_function_space.py |
from typing import Any
import warp as wp
from warp.fem.types import DofIndex, ElementIndex, Coords
from warp.fem import geometry
class FunctionSpace:
"""
Interface class for function spaces, i.e. geometry + interpolation basis
"""
DIMENSION: int
"""Input dimension of the function space"""
... | warp-main | warp/fem/space/function_space.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_marching_cubes.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_streams.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_volume.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_model.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_closest_point_edge_edge.py |
# This file is used to test reloading module references.
import warp as wp
import warp.tests.test_reference_reference as refref
wp.init()
@wp.func
def magic():
return 2.0 * refref.more_magic()
| warp-main | warp/tests/test_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_lerp.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_launch.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_noise.py |
import numpy as np
import warp as wp
from warp.utils import array_sum, array_inner
from warp.tests.test_base import *
wp.init()
def make_test_array_sum(dtype):
N = 1000
def test_array_sum(test, device):
cols = wp.types.type_length(dtype)
values_np = np.random.rand(N, cols)
values =... | warp-main | warp/tests/test_array_reduce.py |
import warp as wp
import numpy as np
wp.init()
@wp.kernel
def arange(out: wp.array(dtype=int)):
tid = wp.tid()
out[tid] = tid
device = "cuda:0"
cmds = []
n = 10
arrays = []
for i in range(5):
arrays.append(wp.zeros(n, dtype=int, device=device))
# setup CUDA graph
wp.capture_begin()
# launch kernels ... | warp-main | warp/tests/test_misc.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_print.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_debug.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_bvh.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_dummy.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_rounding.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_options.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_all.py |
import numpy as np
import warp as wp
from warp.sparse import bsr_zeros, bsr_set_from_triplets, bsr_get_diag, bsr_diag, bsr_set_transpose, bsr_axpy, bsr_mm
from warp.tests.test_base import *
wp.init()
def _get_block(mat, row, col, block_shape):
return mat[row * block_shape[0] : (row + 1) * block_shape[0], col * ... | warp-main | warp/tests/test_sparse.py |
import warp as wp
# dummy class used in test_reload.py
class ClassKernelTest:
def __init__(self, device):
# 3x3 frames in the rest pose:
self.identities = wp.zeros(shape=10, dtype=wp.mat33, device=device)
wp.launch(kernel=self.gen_identities_kernel, dim=10, inputs=[self.identities], device... | warp-main | warp/tests/test_class_kernel.py |
import warp as wp
import numpy as np
from warp.tests.test_base import *
wp.init()
@wp.kernel
def intersect_tri(
v0: wp.vec3, v1: wp.vec3, v2: wp.vec3, u0: wp.vec3, u1: wp.vec3, u2: wp.vec3, result: wp.array(dtype=int)
):
tid = wp.tid()
result[0] = wp.intersect_tri_tri(v0, v1, v2, u0, u1, u2)
def test_... | warp-main | warp/tests/test_intersect.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_mlp.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_mesh.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_volume_write.py |
import warp as wp
wp.init()
@wp.func
def multiply(x: float):
return x * x
@wp.kernel
def kern(expect: float):
wp.expect_eq(multiply(4.0), expect)
def run(expect, device):
wp.launch(kern, dim=1, inputs=[expect], device=device)
| warp-main | warp/tests/test_square.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_atomic.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_array.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_torch.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_vec.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.