如何在 Fortran 中创建自定义数组?
我一直在考虑将 cuda 库移植到 Fortran。 PGI 和 EM Photonics 似乎是目前存在的两个库。但是我只在这里找到了我正在寻找的东西
real, device, allocatable :: adev(:), bdev(:) ! device declaration
所以我的问题是的,有没有办法创建像上面提到的代码示例那样的自定义数组?或者它是 PGI 专有编译器的一部分?
为了更加清晰而进行了编辑
换句话说我可以这样做吗
mycustomtype, allocatable :: tmp(:)
I have been looking at porting a cuda library to fortran. PGI and EM Photonics seem to be two libraries that exist right now. However I have only found what I am looking for over here
real, device, allocatable :: adev(:), bdev(:) ! device declaration
So my question is, is there a way to create custom arrays like the code sample mentioned above ? Or is it part of the propreitary compiler from PGI ?
Edited for further clarity
In other words can I do this
mycustomtype, allocatable :: tmp(:)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这是标准的 Fortran。声明数组的方法有多种;这个特别称为声明延迟形状可分配数组。
最好的办法是查看数组声明下的 PGI 文档。
No, that is standard Fortran. There are several ways to declare arrays; this one in particular is called declaring a deferred-shape allocatable array.
Your best shot would be to check out PGI's documentation under array declaration.