I pulled this script together which checks to see if there is at least 128 MB dedicated to the GPU before starting the program.
#!/bin/bash #check there is enough gpu memory to start #get the gpu memory and output to a file called gpu_mem vcgencmd get_mem gpu > gpu_mem source gpu_mem #strip last char from the output (i.e. 64M) gpu=${gpu%?} if (( $gpu >= 128 )); then ./launch_program else echo "The program needs at least 128MB of memory allocated to the GPU" echo "Use sudo raspi-config (Advanced Options > Memory Split) to change" fi #remove the gpu_mem file rm gpu_mem
good one.
ReplyDelete