Code Monkey home page Code Monkey logo

pycpuid's Introduction

Introduction

PyCPUID reads the information available from the CPUID assembly instruction and makes it available to any Python program.

It could be used to decide on some codepath based on whether the target computer supports SSE2.

import pycpuid
if pycpuid.HAS_SSE2:
    import foobar_sse2 as foobar
else:
    import foobar

It is not the goal of PyCPUID to provide a full report of all CPUID information available. It's merely a way to get raw access to the machine instruction from within Python. Some functions are provided for translation to something human readable, but this is far from complete. Full details on how to interpret the raw data can be found in the application notes of Intel and AMD.

Project maintained by Flight Data Services and released under the GNU Lesses General Public License (LGPL-2.1).

Installation

Package requires pip for installation.

pip install PyCPUID

If you're doing this on Windows you'll need to make sure you have a C++ compiler installed and properly configured.

Source Code

Source code is available from GitHub:

Documentation

Documentation is available from the Python Package Index:

Using PyCPUID

There's not much to it, really. PyCPUID is just a bunch of module constants. Just import the module and access the constants. The HAS_FOOBAR constants are Boolean flags to indicate whether the feature is available. The function features() returns a list of all the available features as strings. There are some other functions like vendor() and brand_string() you can use to identify the CPU.

import pycpuid
print "has SSE2:", pycpuid.HAS_SSE2
print "all availabe features:", pycpuid.features()
print "brand string:", pycpuid.brand_string()
githalytics.com

pycpuid's People

Contributors

bdegreve avatar hoy01ric avatar ngnpope avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.