根据设备屏幕尺寸判断型号及其局限

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/MIRAGE086/article/details/49665637
//根据屏幕尺寸判断手机型号,但是不能区分真机和模拟器,当然iPhone6,6p放大模式可能也会判断出错的
#define Screen_height [[UIScreen mainScreen] bounds].size.height

#define Screen_width [[UIScreen mainScreen] bounds].size.width

#define Screen_scale [[UIScreen mainScreen] scale]

#define iPhone6Plus_StandardMode ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone6_StandardMode ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750,1334), [[UIScreen mainScreen] currentMode].size) : NO)

//#define iPhone5s (CGSizeEqualToSize(CGSizeMake(Screen_width*Screen_scale, Screen_height*Screen_scale), CGSizeMake(1242,2208)) ? YES : NO)

#define iPhone5s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define iPhone4s ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,960), [[UIScreen mainScreen] currentMode].size) : NO)

NSLog(@"%f,%f",[ UIScreen mainScreen ].bounds.size.width,[ UIScreen mainScreen ].bounds.size.height);
    //这个值乘以[[UIScreen mainScreen] scale]就是实际屏幕像素分辨率
    NSLog(@"%f,%f",[ UIScreen mainScreen ].bounds.size.width*[[UIScreen mainScreen] scale],[ UIScreen mainScreen ].bounds.size.height*[[UIScreen mainScreen] scale]);

展开阅读全文

OpenCL中根据哪些设备参数来判断一个OpenCL设备比另一个设备性能更好

02-19

以下是我获取的我电脑中OpenCL设备的各中参数,包括一个CPU和两张显卡。请问从那几个参数来判断我用哪个OpenCL设备更好?rnrnrnNumber of platforms: 2rn CL_PLATFORM_PROFILE: FULL_PROFILErn CL_PLATFORM_VERSION: OpenCL 2.0rn CL_PLATFORM_VENDOR: Intel(R) Corporationrn Number of devices: 2rn CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPUrn CL_DEVICE_MAX_COMPUTE_UNITS: 24rn CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3rn CL_DEVICE_MAX_WORK_ITEM_SIZES: 256 256 256rn CL_DEVICE_MAX_WORK_GROUP_SIZE: 256rn CL_DEVICE_MAX_CLOCK_FREQUENCY: 1050rn CL_DEVICE_ADDRESS_BITS: 32rn CL_DEVICE_MAX_MEM_ALLOC_SIZE: 390280806rn CL_DEVICE_IMAGE_SUPPORT: 1rn CL_DEVICE_MAX_READ_IMAGE_ARGS: 128rn CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 128rn CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE2D_MAX_HEIGHT: 16384rn CL_DEVICE_IMAGE3D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE3D_MAX_HEIGHT: 16384rn CL_DEVICE_IMAGE3D_MAX_DEPTH: 2048rn CL_DEVICE_MAX_SAMPLERS: 16rn CL_DEVICE_MAX_PARAMETER_SIZE: 1024rn CL_DEVICE_MEM_BASE_ADDR_ALIGN: 1024rn CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: 128rn CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST | CL_FP_ROUND_TO_ZERO | CL_FP_ROUND_TO_INFrn CL_DEVICE_SINGLE_FP_CONFIG: CL_READ_ONLY_CACHE | CL_READ_WRITE_CACHErn CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: CL_READ_WRITE_CACHErn CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 64rn CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 524288rn CL_DEVICE_GLOBAL_MEM_SIZE: 1561123226rn CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 65536rn CL_DEVICE_MAX_CONSTANT_ARGS: 8rn CL_DEVICE_LOCAL_MEM_TYPE:rn CL_DEVICE_LOCAL_MEM_SIZE: 65536rn CL_DEVICE_ERROR_CORRECTION_SUPPORT: 0rn CL_DEVICE_HOST_UNIFIED_MEMORY: 1rn CL_DEVICE_PROFILING_TIMER_RESOLUTION: 83rn CL_DEVICE_ENDIAN_LITTLE: 1rn CL_DEVICE_AVAILABLE: 1rn CL_DEVICE_COMPILER_AVAILABLE: 1rn CL_DEVICE_EXECUTION_CAPABILITIES: CL_EXEC_KERNELrn CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLErn CL_DEVICE_PLATFORM: 00AAC578rn CL_DEVICE_NAME: Intel(R) HD Graphics 520rn CL_DEVICE_VENDOR: Intel(R) Corporationrn CL_DRIVER_VERSION: 20.19.15.4364rn CL_DEVICE_PROFILE: FULL_PROFILErn CL_DEVICE_VERSION: OpenCL 2.0rn CL_DEVICE_OPENCL_C_VERSION: OpenCL C 2.0rn CL_DEVICE_EXTENSIONS: cl_intel_accelerator cl_intel_advanced_motion_estimation cl_intel_ctz cl_intel_d3d11_nv12_media_sharing cl_intel_dx9_media_sharing cl_intel_motion_estimation cl_intel_simultaneous_sharing cl_intel_subgroups cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_d3d10_sharing cl_khr_d3d11_sharing cl_khr_depth_images cl_khr_dx9_media_sharing cl_khr_fp16 cl_khr_gl_depth_images cl_khr_gl_event cl_khr_gl_msaa_sharing cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_gl_sharing cl_khr_icd cl_khr_image2d_from_buffer cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_mipmap_image cl_khr_mipmap_image_writes cl_khr_spirrnrn CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPUrn CL_DEVICE_MAX_COMPUTE_UNITS: 4rn CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3rn CL_DEVICE_MAX_WORK_ITEM_SIZES: 8192 8192 8192rn CL_DEVICE_MAX_WORK_GROUP_SIZE: 8192rn CL_DEVICE_MAX_CLOCK_FREQUENCY: 2500rn CL_DEVICE_ADDRESS_BITS: 32rn CL_DEVICE_MAX_MEM_ALLOC_SIZE: 536838144rn CL_DEVICE_IMAGE_SUPPORT: 1rn CL_DEVICE_MAX_READ_IMAGE_ARGS: 480rn CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480rn CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE2D_MAX_HEIGHT: 16384rn CL_DEVICE_IMAGE3D_MAX_WIDTH: 2048rn CL_DEVICE_IMAGE3D_MAX_HEIGHT: 2048rn CL_DEVICE_IMAGE3D_MAX_DEPTH: 2048rn CL_DEVICE_MAX_SAMPLERS: 480rn CL_DEVICE_MAX_PARAMETER_SIZE: 3840rn CL_DEVICE_MEM_BASE_ADDR_ALIGN: 1024rn CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: 128rn CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEARESTrn CL_DEVICE_SINGLE_FP_CONFIG: CL_READ_ONLY_CACHE | CL_READ_WRITE_CACHErn CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: CL_READ_WRITE_CACHErn CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 64rn CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 262144rn CL_DEVICE_GLOBAL_MEM_SIZE: 2147352576rn CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 131072rn CL_DEVICE_MAX_CONSTANT_ARGS: 480rn CL_DEVICE_LOCAL_MEM_TYPE: CL_LOCAL | CL_GLOBALrn CL_DEVICE_LOCAL_MEM_SIZE: 32768rn CL_DEVICE_ERROR_CORRECTION_SUPPORT: 0rn CL_DEVICE_HOST_UNIFIED_MEMORY: 1rn CL_DEVICE_PROFILING_TIMER_RESOLUTION: 395rn CL_DEVICE_ENDIAN_LITTLE: 1rn CL_DEVICE_AVAILABLE: 1rn CL_DEVICE_COMPILER_AVAILABLE: 1rn CL_DEVICE_EXECUTION_CAPABILITIES: CL_EXEC_KERNEL | CL_EXEC_NATIVE_KERNELrn CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLErn CL_DEVICE_PLATFORM: 00AAC578rn CL_DEVICE_NAME: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHzrn CL_DEVICE_VENDOR: Intel(R) Corporationrn CL_DRIVER_VERSION: 5.2.0.10094rn CL_DEVICE_PROFILE: FULL_PROFILErn CL_DEVICE_VERSION: OpenCL 2.0 (Build 10094)rn CL_DEVICE_OPENCL_C_VERSION: OpenCL C 2.0rn CL_DEVICE_EXTENSIONS: cl_khr_icd cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store cl_khr_depth_images cl_khr_3d_image_writes cl_intel_exec_by_local_thread cl_khr_spir cl_khr_dx9_media_sharing cl_intel_dx9_media_sharing cl_khr_d3d11_sharing cl_khr_gl_sharing cl_khr_fp64 cl_khr_image2d_from_bufferrnrnrn CL_PLATFORM_PROFILE: FULL_PROFILErn CL_PLATFORM_VERSION: OpenCL 1.2 CUDA 8.0.44rn CL_PLATFORM_VENDOR: NVIDIA Corporationrn Number of devices: 1rn CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPUrn CL_DEVICE_MAX_COMPUTE_UNITS: 3rn CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3rn CL_DEVICE_MAX_WORK_ITEM_SIZES: 1024 1024 64rn CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024rn CL_DEVICE_MAX_CLOCK_FREQUENCY: 1241rn CL_DEVICE_ADDRESS_BITS: 32rn CL_DEVICE_MAX_MEM_ALLOC_SIZE: 536870912rn CL_DEVICE_IMAGE_SUPPORT: 1rn CL_DEVICE_MAX_READ_IMAGE_ARGS: 256rn CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 16rn CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE2D_MAX_WIDTH: 16384rn CL_DEVICE_IMAGE2D_MAX_HEIGHT: 16384rn CL_DEVICE_IMAGE3D_MAX_WIDTH: 4096rn CL_DEVICE_IMAGE3D_MAX_HEIGHT: 4096rn CL_DEVICE_IMAGE3D_MAX_DEPTH: 4096rn CL_DEVICE_MAX_SAMPLERS: 32rn CL_DEVICE_MAX_PARAMETER_SIZE: 4352rn CL_DEVICE_MEM_BASE_ADDR_ALIGN: 4096rn CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: 128rn CL_DEVICE_SINGLE_FP_CONFIG: CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST | CL_FP_ROUND_TO_ZERO | CL_FP_ROUND_TO_INF | CL_FP_FMArn CL_DEVICE_SINGLE_FP_CONFIG: CL_READ_ONLY_CACHE | CL_READ_WRITE_CACHErn CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: CL_READ_WRITE_CACHErn CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 128rn CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 49152rn CL_DEVICE_GLOBAL_MEM_SIZE: 2147483648rn CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 65536rn CL_DEVICE_MAX_CONSTANT_ARGS: 9rn CL_DEVICE_LOCAL_MEM_TYPE:rn CL_DEVICE_LOCAL_MEM_SIZE: 49152rn CL_DEVICE_ERROR_CORRECTION_SUPPORT: 0rn CL_DEVICE_HOST_UNIFIED_MEMORY: 0rn CL_DEVICE_PROFILING_TIMER_RESOLUTION: 1000rn CL_DEVICE_ENDIAN_LITTLE: 1rn CL_DEVICE_AVAILABLE: 1rn CL_DEVICE_COMPILER_AVAILABLE: 1rn CL_DEVICE_EXECUTION_CAPABILITIES: CL_EXEC_KERNELrn CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLErn CL_DEVICE_PLATFORM: 00AE9CB0rn CL_DEVICE_NAME: GeForce 940MXrn CL_DEVICE_VENDOR: NVIDIA Corporationrn CL_DRIVER_VERSION: 369.30rn CL_DEVICE_PROFILE: FULL_PROFILErn CL_DEVICE_VERSION: OpenCL 1.2 CUDArn CL_DEVICE_OPENCL_C_VERSION: OpenCL C 1.2rn CL_DEVICE_EXTENSIONS: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_optsrn 论坛

没有更多推荐了,返回首页