Resource Management for the Analytics Environment

Resource Settings File

You can set limits on any TKGrid process running across the SAS High-Performance Analytics environment with a resource settings file supplied by SAS. Located in /opt/TKGrid/, resource.settings is in the format of a shell script. When the analytics environment starts, the environment variables contained in the file are set and last for the duration of the run.
Initially, all of the settings in resource.settings are commented. Uncomment the variables and add values that make sense for your site. For more information, see Using CGroups to Manage CPU in SAS LASR Analytic Server: Reference Guide.
When you are finished editing, copy resource.settings to every machine in the analytics environment:
/opt/TKGrid/bin/simcp /opt/TKGrid/resource.settings /opt/TKGrid
If YARN is used on the cluster, then you can configure the analytics environment to participate in the resource accounting that YARN performs. For more information, see Managing Resources in SAS LASR Analytic Server: Reference Guide.
resource.settings consists of the following:
# if [ "$USER" = "lasradm" ]; then
# Custom settings for any process running under the lasradm account.
#   export TKMPI_ULIMIT="-v 50000000"
#   export TKMPI_MEMSIZE=50000
#   export TKMPI_CGROUP="cgexec -g cpu:75"
# fi

# if [ "$TKMPI_APPNAME" = "lasr" ]; then
# Custom settings for a lasr process running under any account.
#   export TKMPI_ULIMIT="-v 50000000"
#   export TKMPI_MEMSIZE=50000
#   export TKMPI_CGROUP="cgexec -g cpu:75"

# Allow other users to read server and tables, but not add or term.
#   export TKMPI_UMASK=0033

# Allow no access by other users to lasr server.
#   export TKMPI_UMASK=0077

# To exclude from YARN resource manager.
#   unset TKMPI_RESOURCEMANAGER

# Use default nice for LASR
# unset TKMPI_NICE
# fi
# if [ "$TKMPI_APPNAME" = "tklogis" ]; then
# Custom settings for a tklogis process running under any account.
#   export TKMPI_ULIMIT="-v 25000000"
#   export TKMPI_MEMSIZE=25000
#   export TKMPI_CGROUP="cgexec -g cpu:25"
#   export TKMPI_MAXRUNTIME=7200
# fi

# fi
# if [ "$TKMPI_INFO" = "LASRLOAD" ]; then
#   TKMPI_INFO is an environment variable that will be passed from 
#              MVA SAS to the grid. It can be used to distinguish a 
#              proc lasr create from a proc lasr add, by including
#              this line before the proc lasr add:
#              options set=TKMPI_INFO="LASRLOAD";
#    To exclude from YARN resource manager.
#    unset TKMPI_RESOURCEMANAGER
# fi

Request Memory with TKMPI_INFO

When programmers use TKMPI_INFO in their SAS code, the SAS High-Performance Analytics environment can better decide how much memory to request.
Consider this example: the $TKMPI_APPNAME variable is set to lasrfor both a SAS Analytic LASR Server (PROC LASR CREATE) and for a SAS Analytic LASR Server Proxy used when loading a table (PROC LASR ADD). This makes it impossible to set a YARN memory limit differently for these two cases. Most likely, a SAS Analytic LASR Server would want a large amount of memory and the proxy server would require a smaller amount.
Here is an example of how you might use TKMPI_INFO in a SAS program to solve the memory issue:
options set=TKMPI_INFO="LASRSTART";
proc lasr create port=17761;
performance nodes=2; run;

options set=TKMPI_INFO="LASRLOAD";
proc lasr add data=sashelp.cars port=17761; run
In resource.settings, you might add an entry similar to the following:
if [ "$TKMPI_APPNAME" = "lasr" ]; then
  if  [ "$TKMPI_INFO" = "LASRSTART" ];
     export TKMPI_MEMSIZE=60000
  fi
  if  [ "$TKMPI_INFO" = "LASRLOAD" ];
     export TKMPI_MEMSIZE=4000
  fi
fi
Note that TKMPI_INFO is not limited to SAS Analytic LASR Server. TKMPI_INFO can also be used for any other HPA PROC. You could use the variable to pass any type of information you need to resource.settings (for example, SMALL, MEDIUM, LARGE classes).
Last updated: June 19, 2017