1
2 # HAT Testing Framework
3
4 ----
5 * [Contents](hat-00.md)
6 * Build Babylon and HAT
7 * [Quick Install](hat-01-quick-install.md)
8 * [Building Babylon with jtreg](hat-01-02-building-babylon.md)
9 * [Building HAT with jtreg](hat-01-03-building-hat.md)
10 * [Enabling the NVIDIA CUDA Backend](hat-01-05-building-hat-for-cuda.md)
11 * [Testing Framework](hat-02-testing-framework.md)
12 * [Running Examples](hat-03-examples.md)
13 * [HAT Programming Model](hat-03-programming-model.md)
14 * Interface Mapping
15 * [Interface Mapping Overview](hat-04-01-interface-mapping.md)
16 * [Cascade Interface Mapping](hat-04-02-cascade-interface-mapping.md)
17 * Development
18 * [Project Layout](hat-01-01-project-layout.md)
19 * Implementation Details
20 * [Walkthrough Of Accelerator.compute()](hat-accelerator-compute.md)
21 * [How we minimize buffer transfers](hat-minimizing-buffer-transfers.md)
22 * [Running HAT with Docker on NVIDIA GPUs](hat-07-docker-build-nvidia.md)
23 ---
24
25
26 ## Local Testing
27
28 For the OpenCL backend:
29
30 ```bash
31 java -cp hat/job.jar hat.java test-suite ffi-opencl
32 ```
33
34 For the CUDA backend:
35
36 ```bash
37 java -cp hat/job.jar hat.java test-suite ffi-cuda
38 ```
39
40 ## Individual tests
41
42 ```bash
43 java -cp hat/job.jar hat.java test-suite ffi-cuda CLASS#method
44 ```
45
46 Passing a particular method to test is optional.
47
48 For example, to test the whole `TestArrays` class:
49
50 ```bash
51 java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestArrays
52
53 HAT Engine Testing Framework
54 Testing Backend: hat.backend.ffi.OpenCLBackend
55
56 Class: hat.test.TestArrays
57 Testing: #testHelloHat ..................... [ok]
58 Testing: #testVectorAddition ..................... [ok]
59 Testing: #testVectorSaxpy ..................... [ok]
60 Testing: #testSmallGrid ..................... [ok]
61
62 passed: 4, failed: 0, unsupported: 0
63 ```
64
65 To test a single method (e.g., `testVectorAddition`):
66
67
68 ```bash
69 java -cp hat/job.jar hat.java test ffi-opencl hat.test.TestArrays#testVectorAddition
70
71 HAT Engine Testing Framework
72 Testing Backend: hat.backend.ffi.OpenCLBackend
73
74 Class: hat.test.TestArrays
75 Testing: #testVectorAddition ..................... [ok]
76
77 passed: 1, failed: 0, unsupported: 0
78 ```
79
80 ## Remote Testing
81
82 HAT provides its own testing framework that can be used to test on remote GPU servers.
83 First, you need to generate and configure the template:
84
85 ```bash
86 bash scripts/remoteTesting.sh --generate-config-file
87 ```
88
89 This flag generates a file in the local directory called `remoteTesting.conf`.
90 We just need to fill the template with the server names, and user names, fork to use, backends to test and the branch to use.
91
92 For instance:
93
94 ```bash
95 # HAT Remote Testing Settings
96 SERVERS=server1 server2
97 REMOTE_USERS=juan juan
98 FORK=git@github.com:my-fork/babylon.git
99
100 #List of Backends to test
101 BACKENDS=ffi-cuda ffi-opencl
102
103 ## Remote path. It assumes all servers use the same path
104 REMOTE_PATH=repos/babylon
105 ## Branch to test
106 BRANCH=code-reflection
107 ```
108
109 This assumes you have the `ssh-keygen` already configured.
110
111 Then, we need to build the project Babylon:
112
113 ```bash
114 bash scripts/remoteTesting.sh --build-babylon
115 ```
116
117 This builds babylon for each of the servers specified. The project is stored in the path specified in `REMOTE_PATH`.
118
119 Once it is finished, you can run the unit-tests on the remote GPU servers as follows:
120
121 ```bash
122 bash scripts/remoteTesting.sh
123 ```