Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint and Format
name: Precommit Checks (Lint and Format)

on:
pull_request:
Expand All @@ -12,15 +12,15 @@ concurrency:
jobs:
pre-commit:
runs-on: ubuntu-24.04
name: ubuntu-24.04-3.12-examples
name: precommit-checks
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11' # Update to your project's version
python-version: '3.12'

- name: Run pre-commit hooks
uses: pre-commit/[email protected]
31 changes: 12 additions & 19 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Start container

- name: Spawn Slurm job
if: github.event_name == 'pull_request'
run: |
SLURM_JOB_NAME="$(uuidgen)_$(date +%Y%m%d_%H%M%S)"
Expand Down Expand Up @@ -74,14 +75,10 @@ jobs:

echo "SLURM_JOB_NAME=${SLURM_JOB_NAME}" >> $GITHUB_ENV
echo "SRUN_COMMON=${SRUN_COMMON}" >> "$GITHUB_ENV"

- name: Build
- name: Initialize Python virtual env
if: github.event_name == 'pull_request'
run: |
srun ${SRUN_COMMON} \
bash .github/workflows/scripts/production_build.sh

- name: Run benchmarks
run: srun ${SRUN_COMMON} bash .github/workflows/scripts/production_build.sh
- name: Run unit tests
if: github.event_name == 'pull_request'
run: |
srun ${SRUN_COMMON} bash -e -s <<'EOF'
Expand All @@ -97,8 +94,7 @@ jobs:

# tmate -S /tmp/tmate.sock wait tmate-exit
EOF

- name: Kill srun job systematically
- name: Kill Slurm job
if: always()
run: |
if [ -n "${SLURM_JOB_NAME}" ] ; then
Expand Down Expand Up @@ -127,7 +123,8 @@ jobs:
# Checkout full history is required to shallow cloning while mark HEAD as "grafted". This breaks remote
# tracking thereby making it impossible to detect whether a commit is contained in upstream main.
fetch-depth: 0
- name: Start container

- name: Spawn Slurm job
run: |
SLURM_JOB_NAME="$(uuidgen)_$(date +%Y%m%d_%H%M%S)"
CONTAINER_NAME="${SLURM_JOB_NAME}"
Expand Down Expand Up @@ -158,12 +155,8 @@ jobs:

echo "SLURM_JOB_NAME=${SLURM_JOB_NAME}" >> $GITHUB_ENV
echo "SRUN_COMMON=${SRUN_COMMON}" >> "$GITHUB_ENV"

- name: Build
run: |
srun ${SRUN_COMMON} \
bash .github/workflows/scripts/production_build.sh

- name: Initialize Python virtual env
run: srun ${SRUN_COMMON} bash .github/workflows/scripts/production_build.sh
- name: Run benchmarks
run: |
srun ${SRUN_COMMON} bash -e -s <<'EOF'
Expand All @@ -172,13 +165,13 @@ jobs:
--print -x -m "benchmarks" ./tests
cat speed_test*.txt > "/mnt/data/artifacts/speed_test_${SLURM_JOB_NAME}.txt"
EOF

- name: Kill srun job systematically
- name: Kill Slurm job
if: always()
run: |
if [ -n "${SLURM_JOB_NAME}" ] ; then
scancel --user=${USER} --name="${SLURM_JOB_NAME}"
fi

- name: Display benchmark stats
run: |
cat "/mnt/data/artifacts/speed_test_${SLURM_JOB_NAME}.txt"
Expand Down
6 changes: 3 additions & 3 deletions examples/tutorials/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

scene = gs.Scene(
viewer_options=gs.options.ViewerOptions(
res=(1280, 960),
res=(1280, 960) if "PYTEST_VERSION" not in os.environ else (64, 64),
camera_pos=(3.5, 0.0, 2.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
Expand Down Expand Up @@ -47,8 +47,8 @@

cam.start_recording()

horizon = 120 if "PYTEST_VERSION" not in os.environ else 5
for i in range(120):
horizon = 120 if "PYTEST_VERSION" not in os.environ else 1
for i in range(horizon):
scene.step()
cam.set_pose(
pos=(3.0 * math.sin(i / 60), 3.0 * math.cos(i / 60), 2.5),
Expand Down
1 change: 1 addition & 0 deletions genesis/engine/couplers/sap_coupler.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ def update_batch_active(self):
norm_thr = self._sap_convergence_atol + self._sap_convergence_rtol * ti.max(
self.sap_state[i_b].momentum_norm, self.sap_state[i_b].impulse_norm
)
self.batch_active[i_b] = self.sap_state[i_b].gradient_norm >= norm_thr

@ti.kernel
def compute_regularization(
Expand Down
5 changes: 3 additions & 2 deletions genesis/engine/solvers/rigid/rigid_solver_decomp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2877,8 +2877,9 @@ def kernel_init_meaninertia(
for i_e in range(n_entities):
for i_d in range(entities_info.dof_start[i_e], entities_info.dof_end[i_e]):
I_d = [i_d, i_b] if ti.static(static_rigid_sim_config.batch_dofs_info) else i_d
# FIXME: this atomic is not necessary but for some reason it improves performance in our benchmarks
ti.atomic_add(rigid_global_info.meaninertia[i_b], rigid_global_info.mass_mat[i_d, i_d, i_b])
rigid_global_info.meaninertia[i_b] = (
rigid_global_info.meaninertia[i_b] + rigid_global_info.mass_mat[i_d, i_d, i_b]
)
rigid_global_info.meaninertia[i_b] = rigid_global_info.meaninertia[i_b] / n_dofs
else:
rigid_global_info.meaninertia[i_b] = 1.0
Expand Down
2 changes: 1 addition & 1 deletion genesis/ext/pyrender/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ def _floor_pass(self, scene, flags, seg_node_map=None, env_idx=-1):
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)

V, P = self._get_camera_matrices(scene, env_idx)
cam_pose = self._get_camera_pose(scene, env_idx)[:3, 3]
cam_pos = self._get_camera_pose(scene, env_idx)[:3, 3]

screen_size = np.array([self.viewport_width, self.viewport_height], np.float32)

Expand Down
2 changes: 1 addition & 1 deletion genesis/utils/image_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def as_grayscale_image(
# Normalize values between 0.0 and 1.0
data_delta = data_max - data_min
data_rel = data_float - data_min if black_to_white else data_max - data_float
data_normalized = np.divide(data_max - data_float, data_delta, where=data_delta > gs.EPS)
data_normalized = np.divide(data_rel, data_delta, where=data_delta > gs.EPS)

# Discretize as unsigned int8
return (data_normalized * 255.0).astype(np.uint8)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
IGNORE_SCRIPT_NAMES = {
"ddp_multi_gpu.py",
"multi_gpu.py",
"visualization.py", # FIXME: Flaky because of possibly undefined shadow map when running in thread
"single_franka_batch_render.py", # FIXME: segfault on exit
"fem_cube_linked_with_arm.py", # FIXME: segfault on exit (corrupted double-linked list)
}
Expand All @@ -33,7 +32,7 @@
"cut_dragon.py",
}

TIMEOUT = 500.0
TIMEOUT = 600.0


pytestmark = [
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rigid_physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,7 @@ def test_nan_reset(gs_sim, mode):
],
)
@pytest.mark.parametrize("is_named", [True, False])
def test_terrain_generation(is_named, show_viewer):
def test_terrain_generation(is_named, show_viewer, tol):
TERRAIN_PATTERN = [
["flat_terrain", "flat_terrain", "flat_terrain", "flat_terrain", "flat_terrain"],
["flat_terrain", "fractal_terrain", "random_uniform_terrain", "sloped_terrain", "flat_terrain"],
Expand Down Expand Up @@ -2287,7 +2287,7 @@ def test_terrain_generation(is_named, show_viewer):
scene = gs.Scene()
terrain_2 = scene.add_entity(gs.morphs.Terrain(**{**terrain_kwargs, **dict(randomize=True)}))
terrain_2_mesh = terrain_2.geoms[0].mesh
assert_allclose(terrain_mesh.verts, terrain_2_mesh.verts, tol=gs.EPS)
assert_allclose(terrain_mesh.verts, terrain_2_mesh.verts, tol=tol)


@pytest.mark.required
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
DEFAULT_BRANCH_NAME = "main"

HUGGINGFACE_ASSETS_REVISION = "701f78c1465f0a98f6540bae6c9daacaa551b7bf"
HUGGINGFACE_SNAPSHOT_REVISION = "f13f28423a8961072832ead74df5d5703e01923e"
HUGGINGFACE_SNAPSHOT_REVISION = "17d79e7627479ef836524d14449e2fdc4282973d"

MESH_EXTENSIONS = (".mtl", *MESH_FORMATS, *GLTF_FORMATS, *USD_FORMATS)
IMAGE_EXTENSIONS = (".png", ".jpg")
Expand Down