[ 
https://issues.apache.org/jira/browse/SPARK-27725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16844066#comment-16844066
 ] 

Thomas Graves commented on SPARK-27725:
---------------------------------------

the above sed command doesn't quite handle it, here is a command that works for 
many gpus:

 

ADDRS=`nvidia-smi --query-gpu=index --format=csv,noheader | sed -e ':a' -e 'N' 
-e'$!ba' -e 's/\n/","/g'`
echo \{\"name\": \"gpu\", \"addresses\":[\"$ADDRS\"]}

> GPU Scheduling - add an example discovery Script
> ------------------------------------------------
>
>                 Key: SPARK-27725
>                 URL: https://issues.apache.org/jira/browse/SPARK-27725
>             Project: Spark
>          Issue Type: Story
>          Components: Examples
>    Affects Versions: 3.0.0
>            Reporter: Thomas Graves
>            Priority: Major
>
> We should add an example script that can be used to discovery GPU's and 
> output the correctly formatted JSON.
> Something like below, but it needs to be tested on various systems with more 
> then 2 gpu's:
> ADDRS=`nvidia-smi --query-gpu=index --format=csv,noheader | sed 
> 'N;s/\n/\",\"/'`
> COUNT=`echo $ADDRS | tr -cd , | wc -c`
> ALLCOUNT=`expr $COUNT + 1`
> #echo \{\"name\": \"gpu\", \"addresses\":[\"$ADDRS\"]}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to