经过异步调用的工作并不cudaFree? [英] Does cudaFree after asynchronous call work?

查看:96
本文介绍了经过异步调用的工作并不cudaFree?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要问打电话来cudaFree一些异步调用后是否有效?例如:

I want to ask whether calling to cudaFree after some asynchronous calls is valid? For example

int* dev_a;

// prepare dev_a...

// launch a kernel to process dev_a (asynchronously)

cudaFree(dev_a);

在此情况下,由于内核启动是异步的,在达到cudaFree部时,内核可以具有不完成运行尚未。然后将cudaFree(DEV_A)后立即销毁数据?

In this case, since kernel launch is asynchronous, when the cudaFree part is reached, the kernel may haven't finish running yet. Then will the cudaFree(dev_a) immediately after it destroy the data?

推荐答案

根据Jared的评论,我一定约99%的CUDA免驱动/ malloc的对作为阻挡,这将同步在其经营范围内调用来实现才执行调用。

As per Jared's comment, I am about 99% certain that the CUDA driver free/malloc pair are implemented as blocking calls which will synchronize the context on which they operate before they execute the call.

这篇关于经过异步调用的工作并不cudaFree?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆