CUDA Fortran:具有单独名称的多个共享数组?
是否确实可以在 CUDA Fortran 中分配多个共享数组,而不必只使用一个共享数组并使用索引偏移?
指针不起作用,“指针”和“目标”属性与“共享”属性冲突。
这就是我想要实现的目标:
attributes(global) subroutine shared_sub_arrays()
integer :: i
real, shared, dimension(*), target :: alldata
real, shared, dimension(:), pointer :: left
real, shared, dimension(:), pointer :: centre
real, shared, dimension(:), pointer :: right
i = threadIdx%x
left => alldata(1:3)
centre => alldata(4:6)
right => alldata(7:9)
left(i) = 1.0
centre(i) = 2.0
right(i) = 3.0
end subroutine shared_sub_arrays
有人知道另一种方法吗?
预先感谢您的帮助
Is it indeed possible to allocate multiple shared arrays in CUDA Fortran without having to resort to having just one shared array and using index offsetting?
Pointers don't work, the 'pointer' and 'target' attributes conflict with the 'shared' attribute.
This is what I want to acheive:
attributes(global) subroutine shared_sub_arrays()
integer :: i
real, shared, dimension(*), target :: alldata
real, shared, dimension(:), pointer :: left
real, shared, dimension(:), pointer :: centre
real, shared, dimension(:), pointer :: right
i = threadIdx%x
left => alldata(1:3)
centre => alldata(4:6)
right => alldata(7:9)
left(i) = 1.0
centre(i) = 2.0
right(i) = 3.0
end subroutine shared_sub_arrays
Does anyone know of another way to do this?
Thanks in advance for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 Portland CUDA Fortran 手册:
这些规则适用于设备数据:
所以我想这是不可能的。至于其他方法,您可以手动跟踪索引(这似乎您不想这样做),或者使用具有 3 列的矩阵,例如
From the Portland CUDA Fortran manual:
These rules apply to device data:
So I guess that's just not possible. As for other ways to do it, you could manually keep track of the indices (which seems you don't want to do), or use a matrix with 3 columns, e.g.