@@ -6,10 +6,10 @@ Sub HelloWorld()
6
6
Dim nRows%, currentRow&, nPlatforms&, nDevices&, i&, j&, result As Boolean
7
7
Dim deviceType$, platformName$, platformVendor$, platformVersion$, deviceVendor$, deviceVersion$, driverVersion$, openCLCVersionString$
8
8
Dim maxComputeUnits&, globalMemorySize#, maxClockFrequency#, maxMemoryAllocationSize#, deviceName$, sources$, cpuCounter&, gpuCounter&
9
- Dim buildLogs$, platformId&, deviceId &, errorString$
9
+ Dim buildLogs$, platformId&, DeviceId &, errorString$
10
10
Dim deviceAvailable As Boolean , compilerAvailable As Boolean
11
- Dim m1# (1 , 1 ), m2# (1 , 1 ), vecM1# (), vecM2# (), vecQ&(0 ), vecResp# (3 ), globalWorkOffset&(), globalWorkSize&(1 ), localWorkSize&()
12
- Dim p&, q&, r&, resp# ()
11
+ Dim m1! (1 , 1 ), m2! (1 , 1 ), vecM1! (), vecM2! (), vecQ&(0 ), vecResp! (3 ), globalWorkOffset&(), globalWorkSize&(1 ), localWorkSize&()
12
+ Dim p&, q&, r&, resp! ()
13
13
14
14
Dim clooConfiguration As New ClooWrapperVBA.Configuration
15
15
Dim progDevice As ClooWrapperVBA .ProgramDevice
@@ -76,7 +76,7 @@ Sub HelloWorld()
76
76
77
77
' Multiplication of two matrices.
78
78
' Read the OpenCL sources.
79
- Open Application.ActiveWorkbook.Path & "\cl\MatrixMultiplication .cl" For Binary As #1
79
+ Open Application.ActiveWorkbook.Path & "\cl\FloatMatrixMultiplication .cl" For Binary As #1
80
80
sources = Space$(LOF(1 ))
81
81
Get #1 , , sources
82
82
Close #1
@@ -87,13 +87,13 @@ Sub HelloWorld()
87
87
result = clooConfiguration.SetPlatform(platformId)
88
88
cpuCounter = 0
89
89
gpuCounter = 0
90
- For deviceId = 0 To clooConfiguration.Platform.Devices - 1
91
- result = clooConfiguration.Platform.SetDevice(deviceId )
90
+ For DeviceId = 0 To clooConfiguration.Platform.Devices - 1
91
+ result = clooConfiguration.Platform.SetDevice(DeviceId )
92
92
93
93
If clooConfiguration.Platform.device.compilerAvailable Then
94
94
If clooConfiguration.Platform.device.deviceType = "CPU" Then
95
95
Set progDevice = New ClooWrapperVBA.ProgramDevice
96
- result = progDevice.Build(sources, "" , platformId, deviceId , cpuCounter, buildLogs)
96
+ result = progDevice.Build(sources, "" , platformId, DeviceId , cpuCounter, buildLogs)
97
97
If result Then
98
98
Exit Do
99
99
Else
@@ -102,7 +102,7 @@ Sub HelloWorld()
102
102
End If
103
103
If clooConfiguration.Platform.device.deviceType = "GPU" Then
104
104
Set progDevice = New ClooWrapperVBA.ProgramDevice
105
- result = progDevice.Build(sources, "" , platformId, deviceId , gpuCounter, buildLogs)
105
+ result = progDevice.Build(sources, "" , platformId, DeviceId , gpuCounter, buildLogs)
106
106
gpuCounter = gpuCounter + 1
107
107
If result Then
108
108
Exit Do
@@ -111,12 +111,12 @@ Sub HelloWorld()
111
111
End If
112
112
End If
113
113
End If
114
- Next deviceId
114
+ Next DeviceId
115
115
platformId = platformId + 1
116
116
Loop
117
117
118
118
errorString = progDevice.errorString
119
- result = progDevice.CreateKernel("DoubleMatrixMult " )
119
+ result = progDevice.CreateKernel("FloatMatrixMult " )
120
120
121
121
' Initialization of arrays:
122
122
p = 2 : q = 2 : r = 2
@@ -125,28 +125,28 @@ Sub HelloWorld()
125
125
m1(i, j) = wsHelloWorld.Cells(i + 1 , j + 7 )
126
126
Next j
127
127
Next i
128
- vecM1 = MatrixToVector (m1, p, q)
128
+ vecM1 = MatrixToVectorSingle (m1, p, q)
129
129
For i = 0 To q - 1
130
130
For j = 0 To r - 1
131
131
m2(i, j) = wsHelloWorld.Cells(i + 3 , j + 7 )
132
132
Next j
133
133
Next i
134
- vecM2 = MatrixToVector (m2, q, r)
134
+ vecM2 = MatrixToVectorSingle (m2, q, r)
135
135
vecQ(0 ) = q
136
136
137
- result = progDevice.SetMemoryArgument_Double (0 , vecResp)
138
- result = progDevice.SetMemoryArgument_Double (1 , vecM1)
139
- result = progDevice.SetMemoryArgument_Double (2 , vecM2)
137
+ result = progDevice.SetMemoryArgument_Single (0 , vecResp)
138
+ result = progDevice.SetMemoryArgument_Single (1 , vecM1)
139
+ result = progDevice.SetMemoryArgument_Single (2 , vecM2)
140
140
result = progDevice.SetMemoryArgument_Long(3 , vecQ)
141
141
142
142
globalWorkSize(0 ) = p
143
143
globalWorkSize(1 ) = r
144
144
145
145
result = progDevice.ExecuteSync(globalWorkOffset, globalWorkSize, localWorkSize)
146
146
147
- result = progDevice.GetMemoryArgument_Double (0 , vecResp)
147
+ result = progDevice.GetMemoryArgument_Single (0 , vecResp)
148
148
149
- resp = VectorToMatrix (vecResp, p, r)
149
+ resp = VectorToMatrixSingle (vecResp, p, r)
150
150
151
151
For i = 0 To p - 1
152
152
For j = 0 To r - 1
0 commit comments