|
28 | 28 | # mpirun -np 4 gpurun env | grep ROCR_VISIBLE_DEVICES |
29 | 29 | # |
30 | 30 |
|
| 31 | +# If set to 1, just invoke the rest of the command line without doing anything |
| 32 | +# else. |
| 33 | +GPURUN_BYPASS=${GPURUN_BYPASS:-0} |
| 34 | + |
| 35 | +if [ "$GPURUN_BYPASS" = "1" ]; then |
| 36 | + exec "$@" |
| 37 | +fi |
| 38 | + |
31 | 39 | # PROGVERSION string is updated by cmake when component is installed |
32 | 40 | PROGVERSION=X.Y-Z |
33 | 41 | function version(){ |
@@ -256,12 +264,10 @@ while read _linepair ; do |
256 | 264 | _this_uuid=$_fieldvalue |
257 | 265 | elif [ "$_fieldtype" == "BDFID" ] ; then |
258 | 266 | if [[ $_last_device_type_was_gpu == 1 ]] ; then |
259 | | - _bdfidstr=`echo "obase=16; $_fieldvalue" | bc | tr '[:upper:]' '[:lower:]'` |
260 | | - if [ ${#_bdfidstr} == 3 ] ; then |
261 | | - _bdfidstr="0${_bdfidstr:0:1}:${_bdfidstr:1:2}" |
262 | | - else |
263 | | - _bdfidstr="${_bdfidstr:0:2}:${_bdfidstr:2:2}" |
264 | | - fi |
| 267 | + # _domain="$(echo "$_fieldvalue / (2^32)" | bc)" |
| 268 | + _bus="$(echo "($_fieldvalue / (2^8)) % (2^8)" | bc)" |
| 269 | + _devfn="$(echo "($_fieldvalue % (2^8))" | bc)" |
| 270 | + _bdfidstr="$(printf "%.2x:%.2x" "$_bus" "$_devfn")" |
265 | 271 | fi |
266 | 272 | elif [ "$_fieldtype" == "Name" ] ; then |
267 | 273 | # The device name field is last in rocminfo output, so we can create new _ri_ array entry |
@@ -354,9 +360,13 @@ for _devid in `ls $_sysdevdir` ; do |
354 | 360 | done |
355 | 361 | # Search _ri_ arrays for matching uuids or matching bdfids. |
356 | 362 | for _ri_i in ${!_ri_bdfids[@]} ; do |
357 | | - if [ $_has_unique_id_file == 1 ] ; then |
| 363 | + if [ "$_has_unique_id_file" == "1" ] ; then |
358 | 364 | _ss_value=$_this_uuid |
359 | 365 | _ri_value=${_ri_uuid[$_ri_i]} |
| 366 | + elif [ "${_ri_bdfids[$_ri_i]}" == "00:00" ]; then |
| 367 | + # Under Hyper-V, we may see a zero BDFID. Fall back to UUID. |
| 368 | + _ss_value=$_devid |
| 369 | + _ri_value=$_devid |
360 | 370 | else |
361 | 371 | _ss_value=$_devid |
362 | 372 | _ri_value="0000:${_ri_bdfids[$_ri_i]}.0" |
|
0 commit comments