Skip to content

Instantly share code, notes, and snippets.

@b0noI
Last active November 13, 2018 23:22
Show Gist options
  • Save b0noI/eb74410fd87603dd88daefd209977633 to your computer and use it in GitHub Desktop.
Save b0noI/eb74410fd87603dd88daefd209977633 to your computer and use it in GitHub Desktop.
#!/bin/bash
# GPU Agent
git clone https://github.com/b0noI/gcp-gpu-utilization-metrics.git
cd gcp-gpu-utilization-metrics
git checkout 6e62ea324bf097817474b51119786e8222dd9fdf
pip install -r ./requirenments.txt
cp ./report_gpu_metrics.py /root/report_gpu_metrics.py
cat <<-EOH > /lib/systemd/system/gpu_utilization_agent.service
[Unit]
Description=GPU Utilization Metric Agent
[Service]
Type=simple
PIDFile=/run/gpu_agent.pid
ExecStart=/bin/bash --login -c '/usr/bin/python /root/report_gpu_metrics.py'
User=root
Group=root
WorkingDirectory=/
Restart=always
[Install]
WantedBy=multi-user.target
EOH
systemctl daemon-reload
systemctl --no-reload --now enable /lib/systemd/system/gpu_utilization_agent.service
cat <<-EOH > /lib/systemd/system/tfserve.service
[Unit]
Description=Inf Logic
[Service]
Type=simple
PIDFile=/run/tfserve_agent.pid
ExecStart=/bin/bash --login -c '/usr/local/bin/tensorflow_model_server --model_base_path=/root/resnet_v2_int8_NCHW/ --rest_api_port=8888'
User=root
Group=root
WorkingDirectory=/
Restart=always
[Install]
WantedBy=multi-user.target
EOH
gsutil cp gs://dl-platform-public-content/blog-posts/t4-release/model.tar.gz /root/model.tar.gz
tar -xzvf /root/model.tar.gz -C /root
systemctl daemon-reload
systemctl --no-reload --now enable /lib/systemd/system/tfserve.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment