CleanUpDevice cleans up the device status including 1. clean up the device buffer for storing results. 2. clean up the cuda streams
()
| 264 | // 1. clean up the device buffer for storing results. |
| 265 | // 2. clean up the cuda streams |
| 266 | func (qc *AQLQueryContext) cleanUpDeviceStatus() { |
| 267 | // clean up foreign table memory after query |
| 268 | for _, foreignTable := range qc.OOPK.foreignTables { |
| 269 | qc.cleanUpForeignTable(foreignTable) |
| 270 | } |
| 271 | qc.OOPK.foreignTables = nil |
| 272 | |
| 273 | // release geo pointers |
| 274 | if qc.OOPK.geoIntersection != nil { |
| 275 | deviceFreeAndSetNil(&qc.OOPK.geoIntersection.shapeLatLongs) |
| 276 | } |
| 277 | |
| 278 | // Destroy streams |
| 279 | cgoutils.DestroyCudaStream(qc.cudaStreams[0], qc.Device) |
| 280 | cgoutils.DestroyCudaStream(qc.cudaStreams[1], qc.Device) |
| 281 | qc.cudaStreams = [2]unsafe.Pointer{nil, nil} |
| 282 | |
| 283 | // Clean up the device result buffers. |
| 284 | qc.OOPK.currentBatch.cleanupDeviceResultBuffers() |
| 285 | |
| 286 | // Clean up timezone lookup buffer. |
| 287 | deviceFreeAndSetNil(&qc.OOPK.currentBatch.timezoneLookupD) |
| 288 | } |
| 289 | |
| 290 | // clean up foreign table |
| 291 | func (qc *AQLQueryContext) cleanUpForeignTable(table *foreignTable) { |
no test coverage detected