Moab Accounting Manager > Appendices > Appendix B: Alternate accounting modes > HPC notional charging

HPC notional charging

Some sites may want to use Moab Accounting Manager to calculate and record charges, but not to restrict or prevent any workload from being serviced. After setting the accounting mode to notional-charging, Moab Accounting Manager will ascribe a charge for resource utilization and attribute it to the entities using it. Liens, balance queries and quotes are not needed. Our main task is to define charge rates.

Set the accounting mode

Set the accounting.mode parameter to notional-charging in both the goldd.conf and gold.conf files.

Example 22-6: Setting the accounting mode to notional-charging

The accounting.mode parameter must be set in the server and client configuration files (goldd.conf and gold.conf). After editing the goldd.conf file, you will need to restart goldd.

$ vi /opt/mam/etc/goldd.conf
 
accounting.mode = notional-charging

 

$ vi /opt/mam/etc/gold.conf

 

accounting.mode = notional-charging

 

$ goldd -r

Usage record customization (optional)

It may be desirable to customize the usage record to display usage properties unique to your site. See the section on Customizing the usage record object for examples.

Decide on a currency and set the currency precision

Since we will be calculating charges, we will need to decide on a currency unit and set the currency precision. For this example we will define a currency in which one credit represents the value of using one processor core for one second. We will assume for simplicity that a processor second on one machine will have the same value as a processor second on another machine. Charges for other resource types will be given an appropriate value relative to this currency unit. All allocations and charges will be specified in terms of this currency. The only action to take here would be to set the currency precision to be the number of decimal places you want Moab Accounting Manager to display when reporting currency amounts. Since processor seconds can easily be represented as an integer with no decimal places and the default currency precision is zero, there is no action to take here. If instead we were to have chosen dollars as the currency base, we would want to set the currency.precision value in goldd.conf, gold.conf and goldg.conf to 2.

Define charge rates

Since we are charging for usage, we must establish the charge rates for the usage. In our example, we will establish a charging scheme that charges 1 credit for each processor second utilized by the job as well as 1 credit for every gigabyte of memory utilized by the job per second.

We will add Processors and Memory with a time-based rate divisor of seconds so their values will be multiplied by the number of seconds they are used. We will define a processor charge rate of 1 currency unit that will charge one credit per processor second used and we will set the memory charge rate divisor to 1024 since we will assume that the memory will be reported in megabytes and we want to charge 1 currency unit for every gigabyte second of memory used. See the chapter on Managing charge rates for more detailed information on setting up charge rates.

Example 22-7: Define charge rates for processors and memory

$ gmkrate -n Processors -z 1/s
 

Successfully created 1 charge rate

 

$ gmkrate -n Memory -z 1/1024/s

 

Successfully created 1 charge rate

 

$ glsrate

 

Name       Value Amount   Description 
---------- ----- -------- -----------
Memory           1/1024/s
Processors       1/s

Integrate Moab Accounting Manager with Moab Workload Manager

If you have not done so already, you will need to configure the Moab suite to interact with Moab Accounting Manager (see Integrate Moab Accounting Manager with Moab Workload Manager).

Run a job

Now let's submit a job and examine the effects on the accounting system.

Example 22-8: Submit a job

$ echo sleep 300 | msub -A chemistry -l procs=12,mem=1024mb,walltime=600

List usage records

After the job completes, a usage record is generated with the charge and resource usage information.

Example 22-9: List the usage and charge for our job

$ glsusage -u amy --show Instance,Charge,User,Account,Machine,Processors,Memory,Duration
 
Instance Charge User Account   Machine Processors Memory Duration
-------- ------ ---- --------- ------- ---------- ------ --------
Moab.1     3900 amy  chemistry colony  12           1024      300

Example 22-10: Viewing itemized charges

If you want to see your charges broken down individually by resource, you will have to have started goldd having charge.itemization = true in your goldd.conf file (see Server configuration).

$ glscharge
UsageRecord Instance Name       Value Duration Rate  ScalingFactor Amount CreationTime        Description
----------- -------- ---------- ----- -------- ----- ------------- ------ ------------------- -----------
1           Moab.1   Processors 12    300      1     1               3600 2014-05-06 10:16:49
1           Moab.1   Memory     1024  300      0.001 1                300 2014-05-06 10:16:49

Issue a refund

Now, since this was a test job, we will refund the charge (see Issuing usage refunds).

Example 22-11: Let's issue a refund for our job

$ grefund -J Moab.1
 

Successfully refunded 3900 credits to usage record 1 for instance Moab.1

Notice that the usage charge is now zero because the job has been fully refunded.

$ glsusage -u amy --show Instance,Charge,User,Account,Machine,Processors,Memory,Duration
 
Instance Charge User Account   Machine Processors Memory Duration
-------- ------ ---- --------- ------- ---------- ------ --------
Moab.1        0 amy  chemistry colony  12         1024   300

© 2014 Adaptive Computing