Skip to content

Commit

Permalink
Upload my test
Browse files Browse the repository at this point in the history
  • Loading branch information
LennoxLiu committed Apr 8, 2024
1 parent e85094f commit 420bc44
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 6 deletions.
2 changes: 1 addition & 1 deletion hpc/hq_scripts/allocation_queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ hq alloc add slurm --time-limit 10m \
--workers-per-alloc 1 \
--max-worker-count 5 \
--cpus=1 \
-- -p "devel" # Add any neccessary SLURM arguments
-- -p "devel" --account=bw22J001 # Add any neccessary SLURM arguments
# Any parameters after -- will be passed directly to sbatch (e.g. credentials, partition, mem, etc.)
7 changes: 2 additions & 5 deletions hpc/hq_scripts/job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ function get_avaliable_port {
}

port=$(get_avaliable_port)
export PORT=$port
export PORT=$port && ./server --port $port & # CHANGE ME!

# Assume that server sets the port according to the environment variable 'PORT'.
/your/model/server/call & # CHANGE ME!

load_balancer_dir="/load/balancer/directory" # CHANGE ME!
load_balancer_dir="./test/MultiplyBy2/" # CHANGE ME!


host=$(hostname -I | awk '{print $1}')
Expand Down
12 changes: 12 additions & 0 deletions hpc/test/MultiplyBy2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
all: build-server build-lb run-lb

load-balancer-files = ../../LoadBalancer.cpp ../../LoadBalancer.hpp ../../lib/httplib.h ../../lib/json.hpp ../../lib/umbridge.h

build-server:
g++ -O3 -w -std=c++11 minimal-server.cpp -o server -lssl -lcrypto -pthread

build-lb:
g++ -O3 -Wno-unused-result -std=c++17 $(load-balancer-files) -o load-balancer -pthread

run-lb:
./load-balancer
31 changes: 31 additions & 0 deletions hpc/test/MultiplyBy2/client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# export TEST_DELAY=1e4

if [ -z "$PORT" ]; then
PORT="4242"
fi

echo "Using URL http://localhost:$PORT"

echo "Sending requests..."

for i in {1..300}
do
# Expected output: {"output":[[200.0]]}
# Check if curl output equals expected output
# If not, print error message

if [ "$(curl -s http://localhost:$PORT/Evaluate -X POST -d '{"name": "forward", "input": [[100.0]]}')" == '{"output":[[200.0]]}' ]; then
echo -n "y"
else
echo $(curl -s http://localhost:$PORT/Evaluate -X POST -d '{"name": "forward", "input": [[100.0]]}')
echo -n "n"
#echo "Error: curl output does not equal expected output"
fi &

done

echo "Requests sent. Waiting for responses..."

wait

0 comments on commit 420bc44

Please sign in to comment.