Skip to content

Commit

Permalink
fix sytax
Browse files Browse the repository at this point in the history
  • Loading branch information
JRPan committed Jun 26, 2024
1 parent bfb1a59 commit 19964eb
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/short-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/checkout@v4
- name: Run Simulation
run: echo "skipped SASS-Simulation. Will perform in merge queue"
SASS-Simulation:
mail-test:
runs-on: tgrogers-raid
defaults:
run:
Expand Down
60 changes: 60 additions & 0 deletions runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python3
from jwt import JWT, jwk_from_pem
import time
import requests

pem = "aalp-self-hosted-runner.2024-06-21.private-key.pem"
client_id = "Iv23lixzRYO8eKFZQCxt"
installation_id = "52081584" # Replace with your actual installation ID

# Open PEM
with open(pem, 'rb') as pem_file:
signing_key = jwk_from_pem(pem_file.read())

payload = {
# Issued at time
'iat': int(time.time()),
# JWT expiration time (in sec, 10 minutes maximum)
'exp': int(time.time()) + 60,
# GitHub App's client ID
'iss': client_id
}

# Create JWT
jwt_instance = JWT()
jwt = jwt_instance.encode(payload, signing_key, alg='RS256')

# Set the URL for the request
url = f"https://api.github.com/app/installations/{installation_id}/access_tokens"

# Set the headers
headers = {
"Accept": "application/vnd.github+json",
"Authorization": f"Bearer {jwt}",
"X-GitHub-Api-Version": "2022-11-28"
}

# Send the POST request
response = requests.post(url, headers=headers)

# Get the "token" field from the response
token = response.json().get("token")

# get token for creating the runners
org = "accel-sim" # Replace with your organization name

# Set the URL for the request
url = f"https://api.github.com/orgs/{org}/actions/runners/registration-token"

# Set the headers
headers = {
"Accept": "application/vnd.github+json",
"Authorization": f"Bearer {token}",
"X-GitHub-Api-Version": "2022-11-28"
}

# Send the POST request
response = requests.post(url, headers=headers)

token = response.json().get("token")
print(token)
Binary file added test
Binary file not shown.
52 changes: 52 additions & 0 deletions test.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include <iostream>
#include <cuda_runtime.h>

__global__ void testDependency(int *start, int *results, int n)
{
int index = threadIdx.x + blockIdx.x * blockDim.x;

int dependency_var = 0;

// # pragma unroll
for (int i = index; i < n; ++i)
{
// if (start[i] < n && i == start[i])
// {
dependency_var = start[i];
// }
}
results[index] = dependency_var;
}

int main()
{
unsigned n = 1024*1024;
int results[n];

int *d_results;
cudaMalloc(&d_results, n * sizeof(int));

int *start, *d_start;
cudaMalloc(&d_start, n * sizeof(int));
cudaMallocHost(&start, n * sizeof(int));

for (int i = 0; i < n; ++i)
{
start[i] = i;
}

cudaMemcpy(d_start, start, n * sizeof(unsigned), cudaMemcpyHostToDevice);

testDependency<<<1, 1>>>(d_start, d_results, n);

cudaMemcpy(results, d_results, n * sizeof(int), cudaMemcpyDeviceToHost);

cudaFree(d_results);

for (int i = 0; i < n / 1024; ++i)
{
std::cout << "Result[" << i << "]: " << results[i] << std::endl;
}

return 0;
}

0 comments on commit 19964eb

Please sign in to comment.