Skip to content

Commit

Permalink
fix segfault issue #283
Browse files Browse the repository at this point in the history
  • Loading branch information
mavenlin committed Oct 26, 2023
1 parent 47ad258 commit d478cda
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions envpool/core/xla.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Array GpuBufferToArray(cudaStream_t stream, const void* buffer,
spec = spec.Batch(batch_size);
}
Array ret(spec);
cudaMemcpy(ret.Data(), buffer, ret.size * ret.element_size,
cudaMemcpyDeviceToHost);
cudaMemcpyAsync(ret.Data(), buffer, ret.size * ret.element_size,
cudaMemcpyDeviceToHost, stream);
return ret;
}

Expand Down Expand Up @@ -161,6 +161,7 @@ struct XlaSend {
...);
},
action_spec);
cudaStreamSynchronize(stream);
envpool->Send(action);
}
};
Expand Down

0 comments on commit d478cda

Please sign in to comment.