GraphicsMagick 的 OpenCL 开发记录(三)

<2022-03-07 Mon>

调用clCreateBuffer()产生异常问题(一)

vscode上的堆栈输出如下:

libc.so.6!__pthread_kill_implementation (Unknown Source:0)
libc.so.6!raise (Unknown Source:0)
libc.so.6!abort (Unknown Source:0)
libigdrcl.so![Unknown/Just-In-Time compiled code] (Unknown Source:0)
libOpenCL.so!clCreateBuffer (Unknown Source:0)
AcquireMagickCLCacheInfo(MagickCLDevice device, Quantum * pixels, const magick_int64_t length) (gm-ocl/magick/opencl.c:569)
GetAuthenticOpenCLBuffer(const Image * image, MagickCLDevice device, ExceptionInfo * exception) (gm-ocl/magick/pixel_cache.c:5252)

因为堆栈显示问题最终是出在__pthread_kill_implementation上,所以我的调查方向一直在线程同步上,代码调试了一遍又一遍却始终没有找到问题。心灰意冷并已经产生从头再开始的想法了。

注意到:

libigdrcl.so![Unknown/Just-In-Time compiled code] (Unknown Source:0)

谷歌了下libigdrcl.so,难道是安装intel驱动的问题?目前使用的是intel-compute-runtime,现改为intel-opencl-runtime,参考自:“GPGPU - ArchWiki”。

$ sudo pacman -Rns intel-compute-runtime
$ yay -S intel-opencl-runtime

我对比了intel-compute-runtimeintel-opencl-runtimeclinfo输出差异发现intel-compute-runtime支持GPUintel-opencl-runtime支持CPU

那代码到底有没有问题?clCreateBuffer()调用失败的原因要不要深究?

vscode环境

// tasks.json
{
   
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
   
            "label": "build with opencl",
            "type": "shell",
            "command": "make",
            "problemMatcher": [],
            "group": {
   
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
// launch.json
{
   
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
   
            "name": "(gdb) Launch",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/utilities/gm",
            "args": ["display", "~/temp/bg1a.jpg"],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [
                {
   
                    "name": "MAGICK_OCL_DEVICE",
                    "value": "true"
                }
            ],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
   
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                },
                {
   
                    "description":  "Set Disassembly Flavor to Intel",
                    "text": "-gdb-set disassembly-flavor intel",
                    "ignoreFailures": true
                }
            ]
        }

    ]
}

正在用的dev.sh内容如下:

#!/bin/bash

./configure CFLAGS='-g -O0' LDFLAGS='-ldl' --enable-opencl --prefix=$HOME/usr/local

commitpartially fix crash when replacing intel-compute-runtime with intel-opencl-runtime

相关推荐

  1. GraphicsMagick OpenCL 开发记录

    2024-01-19 01:18:03       39 阅读
  2. GraphicsMagick OpenCL 开发记录

    2024-01-19 01:18:03       30 阅读
  3. GraphicsMagick OpenCL 开发记录十四)

    2024-01-19 01:18:03       30 阅读
  4. GraphicsMagick OpenCL 开发记录十六)

    2024-01-19 01:18:03       30 阅读
  5. GraphicsMagick OpenCL 开发记录(一)

    2024-01-19 01:18:03       37 阅读
  6. GraphicsMagick OpenCL 开发记录(前言)

    2024-01-19 01:18:03       39 阅读
  7. GraphicsMagick OpenCL 开发记录(十一)

    2024-01-19 01:18:03       31 阅读
  8. GraphicsMagick OpenCL 开发记录(二十六)

    2024-01-19 01:18:03       27 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-19 01:18:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-19 01:18:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-19 01:18:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-19 01:18:03       20 阅读

热门阅读

  1. Github 2024-01-17 C开源项目日报Top9

    2024-01-19 01:18:03       31 阅读
  2. 14 # 泛型:泛型类与泛型约束

    2024-01-19 01:18:03       35 阅读
  3. MySQL 8.0中引入的选项和变量(四)

    2024-01-19 01:18:03       37 阅读
  4. 积木游戏

    2024-01-19 01:18:03       34 阅读
  5. 【git】git更新远程分支到本地

    2024-01-19 01:18:03       34 阅读
  6. Vue前端规范【一】

    2024-01-19 01:18:03       27 阅读