0

我正在嘗試使用OpenCL(Java包裝,使用Eclipse)對一些數據執行一堆計算。內核本身不包含計算;相反,它需要其他功能來完成這項工作。OpenCL:可以乘以浮點數導致內部錯誤?

現在,有一個功能似乎是無效的或某事。這種精細運行:

int scaled(floatMemory fMem, int a, float b){ 
    int result = indexAlloc(fMem); 
    float a0 = getf(fMem,a,0); 
    float a1 = getf(fMem,a,1); 
    float a2 = getf(fMem,a,2); 
    setf(fMem, result, a0, a1, a2); 
    return 0; 
} 

然而,這個代碼會導致內部錯誤(見倒數第二個發言):

int scaled(floatMemory fMem, int a, float b){ 
    int result = indexAlloc(fMem); 
    float a0 = getf(fMem,a,0); 
    float a1 = getf(fMem,a,1); 
    float a2 = getf(fMem,a,2); 
    setf(fMem, result, a0*b, a1*b, a2*b); 
    return 0; 
} 

我嘗試了一些其他的邏輯測試,我想的東西是錯誤的浮點值'b'(即無限或空)。 任何人都可以驗證對我?

PS:這是什麼印在控制檯:

# 
# A fatal error has been detected by the Java Runtime Environment: 
# 
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x5a619b14, pid=7416, tid=12112 
# 
# JRE version: 7.0_25-b16 
# Java VM: Java HotSpot(TM) Client VM (23.25-b01 mixed mode, sharing windows-x86) 
# Problematic frame: 
# C [igdbcl32.dll+0x79b14] Delete+0x78a94 
# 
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 
# 
# An error report file with more information is saved as: 
# ~:\~\~\~\~\~\bin\hs_err_pid7416.log 
# 
# If you would like to submit a bug report, please visit: 
# http://bugreport.sun.com/bugreport/crash.jsp 
# The crash happened outside the Java Virtual Machine in native code. 
# See problematic frame for where to report the bug. 
# 
+0

您使用哪種Java OpenCL包裝? – chippies

回答

0

很抱歉,這是有點晚了,但也許它可以幫助別人。

事實證明,我試圖返回已得到釋放,一旦離開功能的浮動,例如:

float sum(float a, float b) { 
float x = a+b; 
return x; 
} 

變量x並不之外的功能存在,所以,當我試圖從調用者函數訪問它,我得到一個錯誤。解決方案是建立我自己的緩衝區(對接中的痛苦),以便變量在整個線程中保持完整性。