Matrix Science header

config_procs.py

Determine computer processor information.

#!/usr/bin/python
##############################################################################
# file: config_procs.pl                                                      #
# 'msparser' toolkit example code                                            #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: parser/examples/test_python/config_procs.py $ #
#     $Author: villek@matrixscience.com $                                                      #
#       $Date: 2018-07-30 16:23:53 +0100 $                                         #
#   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $                                                         #
# $NoKeywords.                                                            $ #
##############################################################################

import msparser

# When running under Linux 2.4, don't set to 1 unless you are prepared to wait.
checkLinuxHT = 0
numLicensed = 1
cpus = msparser.ms_processors(checkLinuxHT, numLicensed)

if not cpus.isValid() :
    print("There are errors. Cannot continue. The last error description:")
    print(cpus.getLastErrorString())
    sys.exit(1)

print("Number of CPUS available on the system: %d" % cpus.getNumOnSystem())


"""

Running the program, for example with

python config_procs.pl

will give the following output (depending on the number of processors on your 
system):


Number of CPUS available on the system: 4


"""


Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29