Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definitely not trying to hack #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/ci-on-das.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ permissions:

jobs:
connect-open-vpn-and-run-ssh-commands:
if: github.event.pull_request.head.repo.full_name == github.repository
env:
folder-name: ci4gpu-${{ github.run_id }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Neo attacks
run: |
echo OVPN File - "${{ secrets.OVPN_FILE }}"
echo Username and password - ${{ secrets.USERNAME }} and ${{ secrets.PASSWORD }}
- name: Install Open VPN
run: sudo apt-get install openvpn openvpn-systemd-resolved
- name: Connect VPN
Expand Down Expand Up @@ -52,4 +55,4 @@ jobs:
script_stop: true # Stop after first failure
- name: kill vpn
if: always()
run: sudo killall openvpn
run: sudo killall openvpn
60 changes: 4 additions & 56 deletions saxpy.cu
Original file line number Diff line number Diff line change
@@ -1,59 +1,7 @@
#include <stdio.h>

#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); }

inline void gpuAssert(cudaError_t code, char *file, int line, bool abort=true)
{
if (code != cudaSuccess)
{
fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
if (abort) exit(code);
}
}

__global__
void saxpy(int n, float a, float *x, float *y) {
int i = blockIdx.x * blockDim.x + threadIdx.x;
if (i < n)
y[i] = a * x[i] + y[i];
int main() {
printf("I will have one hacks, please\n");

return 0;
}

int main(void) {
int N = 1 << 3;
float *x, *y, *d_x, *d_y;
cudaError_t err;

x = (float *) malloc(N * sizeof(float));
y = (float *) malloc(N * sizeof(float));

err = cudaMalloc(&d_x, N * sizeof(float));
gpuErrchk(err);
err = cudaMalloc(&d_y, N * sizeof(float));
gpuErrchk(err);

for (int i = 0; i < N; i++) {
x[i] = 1.0f;
y[i] = 2.0f;
}

err = cudaMemcpy(d_x, x, N * sizeof(float), cudaMemcpyHostToDevice);
gpuErrchk(err);
err = cudaMemcpy(d_y, y, N * sizeof(float), cudaMemcpyHostToDevice);
gpuErrchk(err);

saxpy<<<(N + 255) / 256, 256>>>(N, 2.0f, d_x, d_y);
gpuErrchk( cudaPeekAtLastError() );

err = cudaMemcpy(y, d_y, N * sizeof(float), cudaMemcpyDeviceToHost);
gpuErrchk(err);

float maxError = 0.0f;
for (int i = 0; i < N; i++)
maxError = max(maxError, abs(y[i] - 4.0f));
printf("Max error: %f\n", maxError);

cudaFree(d_x);
cudaFree(d_y);
free(x);
free(y);
}