OpenMp 与 IOS/Android 的兼容性 [英] OpenMp compatibility with IOS/Android

查看:95
本文介绍了OpenMp 与 IOS/Android 的兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做什么:

我正在编写 C/c++ 代码以构建适用于所有平台的产品(IOS/Android/Windows(移动/桌面)/Mac/Linux)

I am working on C/c++ codes to build a product for all platforms(IOS/Android/Windows(mobile/desktop)/Mac/Linux)

到目前为止我做了什么:

是的,有很多在线链接都在讨论 OpenMp 与不同处理器和操作系统的兼容性,但很难从它们中得出合乎逻辑的结论,因为许多是较旧的文章或特别针对移动目标的帖子.

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.

参考:链接

根据我的分析,是的,openMp 可以与所有 桌面 操作系统(Windows/Mac/Linux)一起使用,并且几乎所有计算机都具有多核 处理器.所以根本不会有任何问题.

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.

谁能帮我找到以下问题的答案?

  1. OpenMp 是否适用于苹果设备(Ipad/iphone)?如果是,是否有任何特定设备与 OpenMP 不兼容?似乎 OpenMP 在 IOS 中一直活跃到 Xcode 4.4.但是,在最新版本的 xcode 中,我看不到 OpenMP 的任何选项.例如:链接

  1. 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

我希望所有高端 android 手机都拥有 1 个以上的内核和基于 ARM 的.根据我的信念,openMp 应该在 NDK 构建的帮助下与 Android 平台一起使用.我的理解正确吗?

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.因为我没有任何 ios 设备,也没有开发环境.

I can't answer on 1. as I don't have any ios devices nor dev environment.

关于 2. 是的,所有高端安卓设备都有 1 个以上的内核.实际上,即使是只有 1 个内核的低端 android 设备也很难找到.但并非所有 Android 设备都只是基于 arm,还有双核和四核 x86 和 x86_64 设备以及 arm64-v8a 设备.

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.

NDK 支持所有这些架构,从第 9 版开始就支持 openmp.使用 gcc(默认情况下是编译器),并将 -fopenmp 添加到 Android.mk Makefile 中 NDK 模块的 CFLAGS 和 LDFLAGS:

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)

这篇关于OpenMp 与 IOS/Android 的兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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