-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtest-cudann-add.rkt
41 lines (39 loc) · 1.36 KB
/
test-cudann-add.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#lang racket/base
(require
rackunit
rackunit/text-ui
ffi/unsafe
"lib-cudann.rkt")
;; define a test case
(define handle-tests
(test-suite
"Tests for cudann"
(test-case
"Check handle creation"
(let* ([block (malloc 'atomic-interior 8)]
[hndlptr (cast block _pointer _cudnnHandle_t-pointer)]
[res (cudnnCreate hndlptr)])
(check-equal? res 'success "Handle Creation")
(let ([hndl (ptr-ref hndlptr _cudnnHandle_t)])
(check-equal? (cudnnDestroy hndl) 'success "Handle Release")
)))
(test-case
"Check creation of a float array"
(let* ([array-ptr (malloc 'atomic-interior 8)]
[res (cudaMalloc array-ptr 4096)])
(check-equal? res 'success "Array Creation")
(check-equal? (cudaFree (ptr-ref array-ptr _pointer)) 'success "Array Release")
))
(test-case
"Check creation of tensor descriptor"
(let* ([desc-ptr (malloc 'atomic-interior (ctype-sizeof _cudnnTensorDescriptor_t))]
[res (cudnnCreateTensorDescriptor (cast desc-ptr _pointer _cudnnTensorDescriptor_t))]
)
(check-equal? res 'success "Tensor Descriptor Creation")
))))
(define initialize-from-array-tests
(test-suite
"Test initialization of float array"
(test-case
"Check the initialization of the float array"
(check-equal? "a" "a"))))