|
| 1 | +print_line() { |
| 2 | + sleep 1 |
| 3 | + for (( i=0; i<50; i++ )); do |
| 4 | + printf '-' |
| 5 | + done |
| 6 | + printf '\n' |
| 7 | +} |
| 8 | + |
| 9 | +echo testing bq |
| 10 | +batchtools bq |
| 11 | +print_line |
| 12 | + |
| 13 | +echo 'testing bps (verbose)' |
| 14 | +batchtools --verbose bps |
| 15 | +print_line |
| 16 | + |
| 17 | +echo 'testing bps (not verbose)' |
| 18 | +batchtools bps |
| 19 | +print_line |
| 20 | + |
| 21 | +echo 'testing br without gpu nowait' |
| 22 | +batchtools br --gpu none --no-wait --name mtest ‘sleep 10 && echo test’ |
| 23 | +print_line |
| 24 | + |
| 25 | +echo 'testing bd w/ one job, no args' |
| 26 | +batchtools bd |
| 27 | +print_line |
| 28 | + |
| 29 | +echo 'testing br with gpu' |
| 30 | +cat <<EOF > hello_test.cu |
| 31 | +#include <stdio.h> |
| 32 | +
|
| 33 | +
|
| 34 | +__global__ void |
| 35 | +helloFromGPU(void) |
| 36 | +{ |
| 37 | + printf("Hello from GPU\\n"); |
| 38 | +} |
| 39 | +
|
| 40 | +
|
| 41 | +int main(void) |
| 42 | +{ |
| 43 | + printf("Hello from CPU\\n"); |
| 44 | + helloFromGPU <<< 1, 3 >>>(); |
| 45 | + cudaDeviceSynchronize(); |
| 46 | + cudaDeviceReset(); |
| 47 | +} |
| 48 | +EOF |
| 49 | + |
| 50 | +nvcc hello_test.cu -o hello |
| 51 | + |
| 52 | +batchtools br './hello' | tee log.txt |
| 53 | + |
| 54 | +print_line |
| 55 | + |
| 56 | +echo 'testing batchtools br no command, should return error' |
| 57 | +batchtools br |
| 58 | + |
| 59 | +print_line |
| 60 | + |
| 61 | +echo 'testing bp, bl, bd no specified jobs' |
| 62 | +batchtools br --gpu none --no-wait 'sleep 10' |
| 63 | + |
| 64 | +printf 'bp one job' |
| 65 | +printf '\n' |
| 66 | + |
| 67 | +batchtools bp |
| 68 | +printf '\n' |
| 69 | + |
| 70 | +printf 'bl one job' |
| 71 | +printf '\n' |
| 72 | + |
| 73 | +batchtools bl |
| 74 | +printf '\n' |
| 75 | + |
| 76 | +batchtools br --gpu none --no-wait 'sleep 10' |
| 77 | + |
| 78 | +printf 'bp two jobs' |
| 79 | +printf '\n' |
| 80 | + |
| 81 | +batchtools bp |
| 82 | +printf '\n' |
| 83 | + |
| 84 | +printf 'bl two jobs' |
| 85 | +printf '\n' |
| 86 | + |
| 87 | +batchtools bl |
| 88 | + |
| 89 | +printf 'bd two jobs, no args' |
| 90 | +batchtools bd |
| 91 | + |
| 92 | +print_line |
| 93 | + |
| 94 | +echo 'testing br with context' |
| 95 | + |
| 96 | +echo "Hello from CUDA file!" > input.txt |
| 97 | + |
| 98 | +cat <<'EOF' > readfile.cu |
| 99 | +#include <stdio.h> |
| 100 | +#include <cuda_runtime.h> |
| 101 | +
|
| 102 | +__global__ void printFile(char *d) { printf("%s\n", d); } |
| 103 | +
|
| 104 | +int main() { |
| 105 | + FILE *f = fopen("input.txt", "r"); |
| 106 | + char t[128]; fgets(t, 128, f); fclose(f); |
| 107 | +
|
| 108 | + char *d; cudaMalloc(&d, 128); |
| 109 | + cudaMemcpy(d, t, 128, cudaMemcpyHostToDevice); |
| 110 | + printFile<<<1,1>>>(d); |
| 111 | + cudaDeviceSynchronize(); |
| 112 | + cudaFree(d); |
| 113 | +} |
| 114 | +EOF |
| 115 | + |
| 116 | +nvcc readfile.cu -o readfile |
| 117 | + |
| 118 | +batchtools br './readfile' |
| 119 | +print_line |
0 commit comments