Addtional create_actor() creates Cuda error: an illegal memory access was encoutered

Hi,

along with my robot actor, I added one simple sphere actor by using these lines:

        ball_asset_options = gymapi.AssetOptions()
        ball_asset_options.disable_gravity = True
        ball_asset_options.fix_base_link = True
     
        ball_asset= self.gym.create_sphere (self.sim, 0.2 , ball_asset_options)
        # set ball dof properties
        ball_dof_props = self.gym.get_asset_dof_properties(ball_asset)
        for i in range(self.num_envs):
            # create env instance
            env_ptr = self.gym.create_env(
                self.sim, lower, upper, num_per_row
            )
            robot_actor = self.gym.create_actor(env_ptr, my_robot_asset, my_robot_start_pose, "my_robot", 1)
            ball_actor = self.gym.create_actor (env_ptr,ball_asset, robot_start_tip_pose, "ball", 2)

Then the reset() function in the post_physics_step() creates error:

def post_physics_step(self):
        self.progress_buf += 1
        env_ids = self.reset_buf.nonzero(as_tuple=False).squeeze(-1)
        if len(env_ids) > 0:
            self.reset(env_ids)
            ...

The complete error messages looks like this:

[Error] [carb.gym.plugin] Gym cuda error: an illegal memory access was encountered: …/…/…/source/plugins/carb/gym/impl/Gym/GymPhysXCuda.cu: 981
Traceback (most recent call last):
File “train.py”, line 35, in
train()
File “train.py”, line 26, in train
ppo.run(num_learning_iterations=ppo_iterations, log_interval=cfg_train[“learn”][“save_interval”])
File “/home/user/.local/lib/python3.6/site-packages/rl_pytorch/ppo/ppo.py”, line 100, in run
current_obs = self.vec_env.reset() # .astype(np.float32)
File “/home/user/Downloads/isaacgym/python/rlgpu/tasks/base/vec_task.py”, line 137, in reset
self.task.step(actions)
File “/home/user/Downloads/isaacgym/python/rlgpu/tasks/base/base_task.py”, line 143, in step
self.post_physics_step()
File “/home/user/Downloads/isaacgym/python/rlgpu/tasks/test.py”, line 404, in post_physics_step
self.reset(env_ids)
File “/home/user/Downloads/isaacgym/python/rlgpu/tasks/test.py”, line 350, in reset
self.progress_buf[env_ids] = 0
RuntimeError: CUDA error: an illegal memory access was encountered

Hi @haraaald45

It’s possible that there are some indexing or slicing operations in your reset function that need to be updated to accommodate for the new actor. You could also try running your code on CPU to see if you get a more helpful error message.

1 Like

Hi,

I have the same problem. Have you found a solution or the reason this happened?