Skip to content

Commit

Permalink
Merge branch 'ershi/1.3.3' into 'release-1.3'
Browse files Browse the repository at this point in the history
Changes for Warp 1.3.3

See merge request omniverse/warp!717
  • Loading branch information
shi-eric committed Sep 4, 2024
2 parents 888c05b + d900fab commit e0319c4
Show file tree
Hide file tree
Showing 15 changed files with 145 additions and 25 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [1.3.3] - 2024-09-04

- Bug fixes
- Fix an aliasing issue with zero-copy array initialization from NumPy introduced in Warp 1.3.0.
- Fix `wp.Volume.load_from_numpy()` behavior when `bg_value` is a sequence of values.

## [1.3.2] - 2024-08-30

- Bug fixes
Expand All @@ -11,7 +17,6 @@
will no longer be unloaded before the graph is released.
- Fix a bug in `wp.sim.collide.triangle_closest_point_barycentric()` where the returned barycentric coordinates may be
incorrect when the closest point lies on an edge.
- Fix an aliasing issue with zero-copy array initialization from NumPy introduced in Warp 1.3.0.
- Fix 32-bit overflow when array shape is specified using `np.int32`.
- Fix handling of integer indices in the `input_output_mask` argument to `autograd.jacobian` and
`autograd.jacobian_fd` ([GH-289](https://github.com/NVIDIA/warp/issues/289)).
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ the `pip install` command, e.g.

| Platform | Install Command |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Linux aarch64 | `pip install https://github.com/NVIDIA/warp/releases/download/v1.3.2/warp_lang-1.3.2+cu11-py3-none-manylinux2014_aarch64.whl` |
| Linux x86-64 | `pip install https://github.com/NVIDIA/warp/releases/download/v1.3.2/warp_lang-1.3.2+cu11-py3-none-manylinux2014_x86_64.whl` |
| Windows x86-64 | `pip install https://github.com/NVIDIA/warp/releases/download/v1.3.2/warp_lang-1.3.2+cu11-py3-none-win_amd64.whl` |
| Linux aarch64 | `pip install https://github.com/NVIDIA/warp/releases/download/v1.3.3/warp_lang-1.3.3+cu11-py3-none-manylinux2014_aarch64.whl` |
| Linux x86-64 | `pip install https://github.com/NVIDIA/warp/releases/download/v1.3.3/warp_lang-1.3.3+cu11-py3-none-manylinux2014_x86_64.whl` |
| Windows x86-64 | `pip install https://github.com/NVIDIA/warp/releases/download/v1.3.3/warp_lang-1.3.3+cu11-py3-none-win_amd64.whl` |

The `--force-reinstall` option may need to be used to overwrite a previous installation.

Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.2
1.3.3
2 changes: 1 addition & 1 deletion exts/omni.warp.core/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
# Semantic Versioning is used: https://semver.org/
version = "1.3.2"
version = "1.3.3"
authors = ["NVIDIA"]
title = "Warp Core"
description="The core Warp Python module"
Expand Down
6 changes: 6 additions & 0 deletions exts/omni.warp.core/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [1.3.3] - 2024-09-04

- Bug fixes
- Fix an aliasing issue with zero-copy array initialization from NumPy introduced in Warp 1.3.0.
- Fix `wp.Volume.load_from_numpy()` behavior when `bg_value` is a sequence of values.

## [1.3.2] - 2024-08-30

- Bug fixes
Expand Down
4 changes: 2 additions & 2 deletions exts/omni.warp/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
# Semantic Versioning is used: https://semver.org/
version = "1.3.2"
version = "1.3.3"
authors = ["NVIDIA"]
title = "Warp"
description="Warp OmniGraph Nodes and Sample Scenes"
Expand Down Expand Up @@ -35,7 +35,7 @@ exclude = ["Ogn*Database.py", "*/ogn*"]
"omni.timeline" = {}
"omni.ui" = {optional = true}
"omni.usd" = {}
"omni.warp.core" = {version = "1.3.2", exact = true}
"omni.warp.core" = {version = "1.3.3", exact = true}

[[python.module]]
name = "omni.warp._extension"
Expand Down
6 changes: 6 additions & 0 deletions exts/omni.warp/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [1.3.3] - 2024-09-04

- Bug fixes
- Fix an aliasing issue with zero-copy array initialization from NumPy introduced in Warp 1.3.0.
- Fix `wp.Volume.load_from_numpy()` behavior when `bg_value` is a sequence of values.

## [1.3.2] - 2024-08-30

- Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion tools/packman/bootstrap/configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
:: See the License for the specific language governing permissions and
:: limitations under the License.

set PM_PACKMAN_VERSION=7.23.1
set PM_PACKMAN_VERSION=7.24.1

:: Specify where packman command is rooted
set PM_INSTALL_PATH=%~dp0..
Expand Down
2 changes: 1 addition & 1 deletion tools/packman/bootstrap/install_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def generate_sha256_for_file(file_path: Union[str, os.PathLike]) -> str:


def install_common_module(package_path, install_path):
COMMON_SHA256 = "0a2064434cca0170411c86f23349f9618556dc380d3589a2361db38ffeea9cac"
COMMON_SHA256 = "ce46783c5a938082514e796a014f8cca5870d6466c6a7147c35e230911dff143"
package_sha256 = generate_sha256_for_file(package_path)
if package_sha256 != COMMON_SHA256:
raise RuntimeError(
Expand Down
46 changes: 39 additions & 7 deletions tools/packman/packman
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else
PM_CURL_SILENT="-s -S"
PM_WGET_QUIET="--quiet"
fi
export PM_PACKMAN_VERSION=7.23.1
export PM_PACKMAN_VERSION=7.24.1

# This is necessary for newer macOS
if [ `uname` == 'Darwin' ]; then
Expand Down Expand Up @@ -60,17 +60,49 @@ if [ ! -d "$PM_PACKAGES_ROOT" ]; then
mkdir -p -m a+rwx "$PM_PACKAGES_ROOT"
fi

execute_with_retry()
{
# Don't exit on error, we need to handle them
set +e

local CMD="$1"
local MAX_TRIES=4
local DELAY=2
local TRIES=0
local exit_code

while [ $TRIES -lt $MAX_TRIES ]
do
((TRIES++))
eval $CMD
exit_code=$?
if [ $exit_code -eq 0 ]; then
return 0
fi

if [ $TRIES -lt $MAX_TRIES ]; then
echo "Attempt $TRIES failed. Retrying in $DELAY seconds ..."
sleep $DELAY
DELAY=$((DELAY * DELAY))
echo "Retrying ..."
fi
done

echo "Command failed after $MAX_TRIES attempts: $CMD"
return $exit_code
}

fetch_file_from_s3()
{
SOURCE=$1
SOURCE_URL=http://bootstrap.packman.nvidia.com/$SOURCE
TARGET=$2
local SOURCE=$1
local SOURCE_URL=http://bootstrap.packman.nvidia.com/$SOURCE
local TARGET=$2
echo "Fetching $SOURCE from bootstrap.packman.nvidia.com ..."
local CMD="curl -o $TARGET $SOURCE_URL $PM_CURL_SILENT"
if command -v wget >/dev/null 2>&1; then
wget $PM_WGET_QUIET -O$TARGET $SOURCE_URL
else
curl -o $TARGET $SOURCE_URL $PM_CURL_SILENT
CMD="wget $PM_WGET_QUIET -O$TARGET $SOURCE_URL"
fi
execute_with_retry "$CMD"
}

generate_temp_file_name()
Expand Down
8 changes: 7 additions & 1 deletion tools/packman/packmanconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ def get_module_dir(conf_dir, packages_root: str, version: str) -> str:
tf = tempfile.NamedTemporaryFile(delete=False)
target_name = tf.name
tf.close()
url = f"http://bootstrap.packman.nvidia.com/packman-common@{version}.zip"
# Using http here and not https is by design. Unfortunately SSL keeps getting revised
# which breaks old clients when servers are forced to upgrade to newer version of TLS
# and refuse to downgrade when asked. Instead of relying on SSL for transport security
# packman does SHA256 verification of the downloaded package in the `install_package`
# method. We therefore inform SonarQube to stop complaining about the line below.
# See issue #367 for more detail.
url = f"http://bootstrap.packman.nvidia.com/packman-common@{version}.zip" # NOSONAR
print(f"Downloading '{url}' ...")
import urllib.request

Expand Down
2 changes: 1 addition & 1 deletion warp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from typing import Optional

version: str = "1.3.2"
version: str = "1.3.3"
"""Warp version string"""

verify_fp: bool = False
Expand Down
34 changes: 34 additions & 0 deletions warp/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,39 @@ def test_array_from_numpy(test, device):
assert_np_equal(result.numpy(), expected.numpy())


def test_array_aliasing_from_numpy(test, device):
device = wp.get_device(device)
assert device.is_cpu

a_np = np.ones(8, dtype=np.int32)
a_wp = wp.array(a_np, dtype=int, copy=False, device=device)
test.assertIs(a_wp._ref, a_np) # check that some ref is kept to original array
test.assertEqual(a_wp.ptr, a_np.ctypes.data)

a_np_2 = a_wp.numpy()
test.assertTrue((a_np_2 == 1).all())

# updating source array should update aliased array
a_np.fill(2)
test.assertTrue((a_np_2 == 2).all())

# trying to alias from a different type should do a copy
# do it twice to check that the copy buffer is not being reused for different arrays

b_np = np.ones(8, dtype=np.int64)
c_np = np.zeros(8, dtype=np.int64)
b_wp = wp.array(b_np, dtype=int, copy=False, device=device)
c_wp = wp.array(c_np, dtype=int, copy=False, device=device)

test.assertNotEqual(b_wp.ptr, b_np.ctypes.data)
test.assertNotEqual(b_wp.ptr, c_wp.ptr)

b_np_2 = b_wp.numpy()
c_np_2 = c_wp.numpy()
test.assertTrue((b_np_2 == 1).all())
test.assertTrue((c_np_2 == 0).all())


def test_array_from_cai(test, device):
import torch

Expand Down Expand Up @@ -2447,6 +2480,7 @@ def test_array_new_del(self):
add_function_test(TestArray, "test_array_of_structs_from_numpy", test_array_of_structs_from_numpy, devices=devices)
add_function_test(TestArray, "test_array_of_structs_roundtrip", test_array_of_structs_roundtrip, devices=devices)
add_function_test(TestArray, "test_array_from_numpy", test_array_from_numpy, devices=devices)
add_function_test(TestArray, "test_array_aliasing_from_numpy", test_array_aliasing_from_numpy, devices=["cpu"])

add_function_test(TestArray, "test_direct_from_numpy", test_direct_from_numpy, devices=["cpu"])
add_function_test(TestArray, "test_kernel_array_from_ptr", test_kernel_array_from_ptr, devices=devices)
Expand Down
30 changes: 30 additions & 0 deletions warp/tests/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,33 @@ def test_volume_from_numpy(test, device):
test.assertIsNone(sphere_vdb_array.deleter)


def test_volume_from_numpy_3d(test, device):
# Volume.allocate_from_tiles() is only available with CUDA
mins = np.array([-3.0, -3.0, -3.0])
voxel_size = 0.2
maxs = np.array([3.0, 3.0, 3.0])
nums = np.ceil((maxs - mins) / (voxel_size)).astype(dtype=int)
centers = np.array([[-1.0, -1.0, -1.0], [0.0, 0.0, 0.0], [1.0, 1.0, 1.0]])
rad = 2.5
sphere_sdf_np = np.zeros(tuple(nums) + (3,))
for x in range(nums[0]):
for y in range(nums[1]):
for z in range(nums[2]):
for k in range(3):
pos = mins + voxel_size * np.array([x, y, z])
dis = np.linalg.norm(pos - centers[k])
sphere_sdf_np[x, y, z, k] = dis - rad
sphere_vdb = wp.Volume.load_from_numpy(
sphere_sdf_np, mins, voxel_size, (rad + 3.0 * voxel_size,) * 3, device=device
)

test.assertNotEqual(sphere_vdb.id, 0)

sphere_vdb_array = sphere_vdb.array()
test.assertEqual(sphere_vdb_array.dtype, wp.uint8)
test.assertIsNone(sphere_vdb_array.deleter)


def test_volume_aniso_transform(test, device):
# XY-rotation + z scale
transform = [
Expand Down Expand Up @@ -894,6 +921,9 @@ def test_volume_new_del(self):
add_function_test(
TestVolume, "test_volume_from_numpy", test_volume_from_numpy, devices=get_selected_cuda_test_devices()
)
add_function_test(
TestVolume, "test_volume_from_numpy_3d", test_volume_from_numpy_3d, devices=get_selected_cuda_test_devices()
)
add_function_test(
TestVolume, "test_volume_aniso_transform", test_volume_aniso_transform, devices=get_selected_cuda_test_devices()
)
Expand Down
13 changes: 7 additions & 6 deletions warp/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1601,6 +1601,9 @@ def __init__(
self._array_interface = None
self.is_transposed = False

# reference to other array
self._ref = None

# canonicalize dtype
if dtype == int:
dtype = int32
Expand Down Expand Up @@ -1652,9 +1655,6 @@ def __init__(
if requires_grad:
self._alloc_grad()

# reference to other array
self._ref = None

def _init_from_data(self, data, dtype, shape, device, copy, pinned):
if not hasattr(data, "__len__"):
raise RuntimeError(f"Data must be a sequence or array, got scalar {data}")
Expand Down Expand Up @@ -2991,7 +2991,7 @@ def __init__(self, points=None, indices=None, velocities=None, support_winding_n
Args:
points (:class:`warp.array`): Array of vertex positions of type :class:`warp.vec3`
indices (:class:`warp.array`): Array of triangle indices of type :class:`warp.int32`, should be a 1d array with shape (num_tris, 3)
indices (:class:`warp.array`): Array of triangle indices of type :class:`warp.int32`, should be a 1d array with shape (num_tris * 3)
velocities (:class:`warp.array`): Array of vertex velocities of type :class:`warp.vec3` (optional)
support_winding_number (bool): If true the mesh will build additional datastructures to support `wp.mesh_query_point_sign_winding_number()` queries
"""
Expand Down Expand Up @@ -3529,8 +3529,9 @@ def load_from_numpy(
)
if hasattr(bg_value, "__len__"):
# vec3, assuming the numpy array is 4D
padded_array = np.array((target_shape[0], target_shape[1], target_shape[2], 3), dtype=np.single)
padded_array[:, :, :, :] = np.array(bg_value)
padded_array = np.full(
shape=(target_shape[0], target_shape[1], target_shape[2], 3), fill_value=bg_value, dtype=np.single
)
padded_array[0 : ndarray.shape[0], 0 : ndarray.shape[1], 0 : ndarray.shape[2], :] = ndarray
else:
padded_amount = (
Expand Down

0 comments on commit e0319c4

Please sign in to comment.