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