我最近发现了GP-GPU(通用图形处理单元)的强大功能,并希望利用它在一台机器上执行"繁重"的科学和数学计算(否则需要大型CPU集群).
我知道有几个接口可以在GPU上运行,其中最突出的是CUDA和OpenCL.后者具有防止CUDA在大多数显卡(NVIDIA,AMD,Intel)上运行的优势,而不仅仅是NVIDA卡.在我的情况下,我有一个普通的Intel 4000 GPU似乎与OpenCL很好地合作.
现在,我需要学习如何使用PyOpenCL来进一步操作!所以这里有一个问题:
我怎样才能开始使用PyOpenCL?有什么先决条件?我真的需要有Python和/或OpenCL的经验吗?
我的背景是在fortran中,事实上我需要将冗长的fortran代码翻译并并行化为python(或pyopencl),主要处理PDE和对角化矩阵.
我已阅读了两个相关网站http://enja.org/2011/02/22/adventures-in-pyopencl-part-1-getting-started-with-python/和http://documen.tician.de/ pyopencl /但它们对新手(即假人)并没有真正的帮助.
我只是不知道该怎么做.我不想成为该领域的专家,只是为了了解如何在pyopencl上并行化简单的数学和线性代数.
任何建议和帮助都非常欢迎!
为什么在下面的代码中需要typedef?
typedef enum _Coordinate {
CoordinateX = 0, ///< X axis
CoordinateY = 1, ///< Y axis
CPCoordinateZ = 2 ///< Z axis
} Coordinate;
Run Code Online (Sandbox Code Playgroud)
为什么不只是下面的代码并删除typedef?
enum Coordinate {
CoordinateX = 0, ///< X axis
CoordinateY = 1, ///< Y axis
CPCoordinateZ = 2 ///< Z axis
};
Run Code Online (Sandbox Code Playgroud) 我做了加法和减法,但我很难在python中乘以多项式.
例如,如果我有:
2X^2 + 5X + 1 [1,5,2]
Run Code Online (Sandbox Code Playgroud)
和...
3X^3 + 4X^2 + X + 6 [6,1,4,3]
Run Code Online (Sandbox Code Playgroud)
我们得到:
6X^5 + 23X^4 + 25X^3 + 21X^2 + 31X + 6 [6,31,21,25,23,6]
Run Code Online (Sandbox Code Playgroud)
我很绝望.我已经在这里工作了好几天.任何帮助,将不胜感激
我有一个带有tabbar的应用程序,我想在其中检测界面方向.
我在info.plist中设置了支持的方向.这是我的主要接口声明:
@interface MyAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
...
}
Run Code Online (Sandbox Code Playgroud)
这是在MyAppDelegate的实现中:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)
return NO;
if (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
return YES;
if (interfaceOrientation == UIInterfaceOrientationPortrait)
return YES;
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
return NO;
}
Run Code Online (Sandbox Code Playgroud)
在我试图检测方向变化的必要视图中,我称之为以下方法:
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
Run Code Online (Sandbox Code Playgroud)
和
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation;
Run Code Online (Sandbox Code Playgroud)
我已经在这些方法中设置了NSLog打印,它们都没有注册任何更改.甚至没有在shouldAutorotateToInterfaceOrientation方法中.
谁能帮帮我吗?我做错了什么?任何帮助将不胜感激.
objective-c ×2
python ×2
c ×1
enums ×1
gpgpu ×1
iphone ×1
opencl ×1
orientation ×1
pyopencl ×1
typedef ×1