问题
What i am trying to do:
I am working on C/c++ codes to build a product for all platforms(IOS/Android/Windows(mobile/desktop)/Mac/Linux)
What have i done so far:
Yes there are many online links talking about OpenMp's Compatibility with different processors and OS's, but its hard to make a logical conclusion from them because many are older article or posts especially wrt to mobile targets.
Ref: Link
As per my analysis, yes, openMp can work with all desktop OS's (Windows/Mac/Linux) and almost all the computers have multi core processors now. So there won't be any issue at all.
Can anyone help me to find the answer for the following things?
Does OpenMp work with apple device (Ipad/iphones)? If yes, is there any specific device which is not compatible with OpenMP? Seems OpenMP was active in IOS till Xcode 4.4. But,in the latest version of xcode, i am not able to see any options for OpenMP. Eg: Link
I hope all the higher end android mobiles have more than 1 cores and ARM based. As per my belief, the openMp should work with Android platforms with the help of NDK building. Is my understanding correct?
回答1:
I can't answer on 1. as I don't have any ios devices nor dev environment.
Regarding 2. Yes, all the higher end android devices have more than 1 cores. It's actually hard to find even a low end android device with only 1 core. But not all Android devices are simply arm-based, there are also dual and quad cores x86 and x86_64 devices as well as arm64-v8a devices.
The NDK supports all these architectures, with openmp as well since its 9th version. Use gcc (it's the compiler by default), and add -fopenmp
to your NDK module's CFLAGS and LDFLAGS in your Android.mk Makefile:
include $(CLEAR_VARS)
LOCAL_MODULE := yourmodule
LOCAL_SRC_FILES := yourmodule.c
LOCAL_CFLAGS += -fopenmp
LOCAL_LDFLAGS += -fopenmp
include $(BUILD_SHARED_LIBRARY)
来源:https://stackoverflow.com/questions/28338425/openmp-compatibility-with-ios-android