Editing
Tutorials:Monitoring with Tensorboard on the GPU cluster
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Viewing the Tensorboard of the job == Note: Option 1 will be phased out, as local volumes will probably not be supported anymore in the future (not flexible enough during scheduling). We suggest a variant of Option 2, with tensorboard running directly in your compute container, so that the PVC needs to be mounted only once (in case you have a storage class which only can be mounted a single time, which is likely since you need write support). === Option 1: Using compute node global Tensorboard instance === As stated earlier, each compute node has its own instance of Tensorboard running. This instance will automatically display all Tensorboard summary files contained in persistent volumes with <code>storageClassName: local-tensorboard</code>. First, find out the compute node your pod was allocated to. <syntaxhighlight lang="python"> > kubectl get pods | grep your-username NAME READY STATUS RESTARTS AGE your-username-tf-mnist-tb-pvc-mqt9m 1/1 Running 0 3m4s > kubectl describe pod your-username-tf-mnist-tb-pvc-mqt9m | grep Node Node: glasya/134.34.226.30 </syntaxhighlight> Your pod is running on [[Cluster:Compute nodes|Glasya]], IP 134.34.226.30. You can now point your browser to 134.34.226.30:6116 to access the Tensorboard instance for the node. Note that it lists the logs for all currently mounted PVs. To find out which directory your PV corresponds to, you need to check which PV your PVC was bound to, and inspect its data: <syntaxhighlight lang="python"> > kubectl get pvc | grep your-username your-username-tf-mnist-tb-pvc Bound local-pv-d07aa16c 25Gi RWO local-tensorboard 19m > kubectl describe pv local-pv-d07aa16c | grep Path Path: /mnt/tensorboard/glasya-pv-tb-25gb-2 </syntaxhighlight> This means that your logs will be the ones prefixed by "glasya-pv-tb-25gb-2" in the Tensorboard instance. === Option 2: Run your own Tensorboard instance === Another option is to create a pod running your own Tensorboard instance which is exposed via a Kubernetes service. First create a pod running Tensorboard which is listening to your summary directory. In order to do so, we can simply use the [https://hub.docker.com/r/tensorflow/tensorflow/ latest Tensorflow container] from Docker Hub:<code>tensorflow/tensorflow:latest-py3</code>. The corresponding pod should look like this: <syntaxhighlight lang="yaml"> apiVersion: v1 kind: Pod metadata: name: your-username-tb-pod labels: run: your-username-tb-0 spec: containers: - name: your-username-tb-container image: tensorflow/tensorflow:latest-py3 # Execute Tensorboard in your mounted summaries folder. This will make the pod run indefinitely if no errors occur. Make sure to delete the pod if you do not use it anymore. command: ["/bin/bash"] args: ["-c", "cd /mnt/tensorboard/; tensorboard --logdir ."] # Mount the persistent volume where you log Tensorboard summaries to volumeMounts: - mountPath: "/mnt/tensorboard" name: your-username-tb # Expose Tensorboard port, which is 6006 by default. ports: - containerPort: 6006 protocol: TCP restartPolicy: Never volumes: - name: your-username-tb persistentVolumeClaim: claimName: your-username-tb-pvc </syntaxhighlight> Run the pod as usual. Next, we need to create a Kubernetes service mapping the Tensorboard pod IP and port to some fixed service IP and expose it publicly. This can be done using the <code>kubectl expose</code> command: <syntaxhighlight lang="python"> kubectl expose pod *pod-name* --type=NodePort --name=*your-username-service-name* </syntaxhighlight> Replace *pod-name* with the name of the Tensorboard pod you just started and give the Service some name. You can check all running services with <code>kubectl get svc</code>. Your service should be in this list. Kubernetes will automatically choose a port (NodePort) to expose, which we need to access Tensorboard. Get the NodePort with: <syntaxhighlight lang="python"> kubectl describe svc *your-username-service-name*| grep NodePort Type: NodePort: NodePort: <unset> *NodePort*/TCP </syntaxhighlight> At last, find out the IP of the cluster node the Tensorboard pod is running on like described in Option 1. Then, your Tensorboard instance can be accessed via <code>*cluster-node-ip*:*service-node-port*</code>. For more general information on how to expose an Application running in a Kubernetes pod see [https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/ this]. [[Category:Tutorials]]
Summary:
Please note that all contributions to Collective Computational Unit may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
CCU:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Collective Computational Unit
Main page
Projects
Tutorials
GPU Cluster
Core Facilitys
Mediawiki
Recent changes
Random page
Help
Tools
What links here
Related changes
Page information