Skip to content

pwrapi/cray_pwrapi

Repository files navigation

Cray PowerAPI

Description

This package provides the Cray implementation of version 2.0 of the PowerAPI Specification.

The source RPM package and tar-file have been configured so that the source can be compiled on a Cray XC system login node using either:

  • The rpmbuild command to produce binary RPM packages for installation into node images.
  • The configure and make commands to produce binaries without packaging them in binary RPM packages.

It is recommended that the rpmbuild command be used to build binary RPM packages that are then installed into images used to boot the compute nodes. Doing so will ensure that the presence of the PowerAPI binaries is recognized as part of the configuration should the assistance of Cray support be required.

Additional information about the PowerAPI can be found at the project website project is located at http://powerapi.sandia.gov

Assumptions

  1. Familiarity with:
    • Creating and copying node images.
    • Installing RPMs into node images.
    • Creating bootable images for the login and compute nodes.
  2. Building is done on the login node of a Cray XC system.
  3. Building is done using a non-root user account.
  4. An RPM spec file, usually referred to as a spec file, contains build and installation directives for building binary RPM packages.
  5. The compressed tar file of the source code and spec file is called a tarball.
  6. Source code from Cray is provided as a tarball
  7. Building the source code will be done using the rpmbuild tool.
    • It is possible to build binaries from the source without using rpmbuild but this document limits the build description to the use of rpmbuild.
  8. Binary and source RPM packages produced from the Cray PowerAPI source code, when rebuilt on an XC login node are:
    • cray-libpowerapi0-1.0-${B}.x86_64.rpm
      • The runtime shared libraries and modules.
    • cray-libpowerapi-devel-1.0-${B}.x86_64.rpm
      • The development libraries and include files.
    • cray-powerapi-powerapid-1.0-${B}.x86_64.rpm
      • The powerapid control daemon and system startup files.
    • cray-powerapi-cnctl-1.0-${B}.x86_64.rpm
      • The compute node control command for power management
    • cray-powerapi-pwrcmd-1.0-${B}.x86_64.rpm
      • An application to demonstrate and test library capabilities
    • cray-powerapi-test-1.0-${B}.x86_64.rpm
      • Regression testing suite
    • cray-powerapi-1.0-${B}.src.rpm
      • The source RPM package

Installing

The PowerAPI package should be installed per instructions for installing third-party software on Cray XC systems.

Please consult the document, XC(tm) Series System Administration Guide (CLE 6.0 UP02) S-2392, sub-section Install Third-Party Software With a Custom Image

What to install in login node image

To allow compilation of applications and commands that use the PowerAPI library, the development package must be installed into the login node image.

The development package is the RPM file with the name:

  • cray-libpowerapi0-1.0-${B}.x86_64.rpm
  • cray-libpowerapi-devel-1.0-${B}.x86_64.rpm

If using a netroot image for the login node, the above packages need to be installed into the netroot image.

What to install in compute node image

The following packages must be installed into the compute node image:

  • cray-libpowerapi0-1.0-${B}.x86_64.rpm
  • cray-powerapi-cnctl-1.0-${B}.x86_64.rpm
  • cray-powerapi-powerapid-1.0-${B}.x86_64.rpm
  • cray-powerapi-pwrcmd-1.0-${B}.x86_64.rpm
  • cray-powerapi-test-1.0-${B}.x86_64.rpm

If using a netroot image for the compute nodes, the above packages need to be installed into the netroot image.

Rebuilding

Building the source code consists of the following steps:

  1. Setup the build environment.
  2. Update the configuration for the build environment.
  3. Configure the build environment.
  4. Compile the source.
  5. Package files for installation.

Building using the rpmbuild tool performs all of the above steps. Options can be specified to only perform a subset of those steps. It is possible to build the source code without using rpmbuild, but this document only describes the use of rpmbuild.

Preparing to build

The following macros (defines) are useful. They will vary depending on the specific source file you receive.

    cray-powerapi-${V}-${B}.src.rpm
                  ^^^^      (version)
                       ^^^^ (build)

    version: ${V} is the software version, as provided by the spec file
    build:   ${B} is the build number pair generated by Cray's build system

Source RPM Rebuild

The source RPM rebuild option uses the standard RPM build process. This places all sources in standard locations in ~/rpmbuild.

If you are logged in as root, the standard location will instead be /usr/src/packages.

The following assumes you are a normal user (not root).

  1. Install the source code.
    $ rpm -Uvh --force cray-powerapi-${V}-${B}.src.rpm
  1. Change directory to the location of the spec file.
    $ cd ~/rpmbuild/SPECS
  1. Use one of the following commands to build the code.
    $ rpmbuild -ba cray-powerapi.spec
    $ rpmbuild -bb cray-powerapi.spec
    $ rpmbuild -bc cray-powerapi.spec
    $ rpmbuild -bs cray-powerapi.spec

These are described in detail below.

Tarball Rebuild

This option may be useful if you want to create a buildable tarball. The tarball supplied needs to be modified to contain the spec file, as follows.

  1. Extract the files from the source RPM file
    $ rpm2cpio cray-powerapi-${V}-${B}.src.rpm | cpio -idmv

This will provide the compressed tar file and the spec file.

  1. Modify the tarball
    $ bzip2 -d cray-powerapi-${V}.tar.bz2
    $ tar -f cray-powerapi-${V}.tar --delete cray-powerapi.spec 2>/dev/null
    $ tar -f cray-powerapi-${V}.tar --update cray-powerapi.spec
    $ bzip2 cray-powerapi-${V}.tar
  1. Use one of the following commands to build the code.
    $ rpmbuild -ta cray-powerapi-${V}.tar.bz2
    $ rpmbuild -tb cray-powerapi-${V}.tar.bz2
    $ rpmbuild -tc cray-powerapi-${V}.tar.bz2
    $ rpmbuild -ts cray-powerapi-${V}.tar.bz2

These are described in detail below.

Building binary and source RPM packages

To build all of the binary and source RPM packages:

    $ rpmbuild -ba cray-powerapi.spec (source RPM rebuild)
        - or -
    $ rpmbuild -ta cray-powerapi-${V}.tar.bz2 (tarball rebuild)

This will create the ~/rpmbuild directory if it does not already exist, installing the source tarball into the SOURCES subdirectory and the spec file into the SPECS subdirectory. The command will then unpack the source tarball and build the source per the spec file directives to produce binary and source RPM packages. The binary RPM packages will be copied into the ~/rpmbuild/RPMS/x86_64 directory and the source RPM package will be copied into the ~/rpmbuild/SRPMS directory.

You should see:

...
Wrote: ${HOME}/rpmbuild/SRPMS/cray-powerapi-${V}-${B}.src.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-libpowerapi-devel-${V}-${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-libpowerapi0-${V}-${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-cnctl-${V}-${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-powerapid-${V}-${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-pwrcmd-${V}-${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-test-${V}-${B}.x86_64.rpm

Building only the binary RPM packages

To only build the binary RPM packages, without the source RPM package:

    $ rpmbuild -bb cray-powerapi.spec (source RPM rebuild)
        - or -
    $ rpmbuild -tb cray-powerapi-${V}.tar.bz2 (tarball rebuild)

This will create the ~/rpmbuild directory if it does not already exist, installing the source tarball into the SOURCES subdirectory and the spec file into the SPECS subdirectory. The command will then unpack the source tarball and build the source per the spec file directives to produce binary RPM packages that will be copied into the directory ~/rpmbuild/RPMS/x86_64.

You should see:

...
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-libpowerapi-devel-${V}-${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-libpowerapi0-${V}.${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-cnctl-${V}.${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-powerapid-${V}.${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-pwrcmd-${V}.${B}.x86_64.rpm
Wrote: ${HOME}/rpmbuild/RPMS/x86_64/cray-powerapi-test-${V}.${B}.x86_64.rpm

Building only the source RPM packages

To only build the source RPM package, without the binary RPM packages:

    $ rpmbuild -bs cray-powerapi.spec (source RPM rebuild)
        - or -
    $ rpmbuild -ts cray-powerapi-${V}.tar.bz2 (tarball rebuild)

This will create the ~/rpmbuild directory if it does not already exist, installing the source tarball into the SOURCES subdirectory and the spec file into the SPECS subdirectory. The command will then produce a source RPM package. The source RPM package will be copied into the ~/rpmbuild/SRPMS directory.

You should see:

...
Wrote: ${HOME}/rpmbuild/SRPMS/cray-powerapi-${V}.ari.src.rpm

Redoing only the source compile

To only perform the source compilation phase of the build:

    $ rpmbuild -tc cray-powerapi.spec (source RPM rebuild)
        - or -
    $ rpmbuild -tc cray-powerapi-${V}.tar.bz2 (tarball rebuild)

This will skip the steps involved in packaging the binary and source RPM packages. It will create the ~/rpmbuild directory if it does not already exist, installing the source tarball into the SOURCES subdirectory and the spec file into the SPECS subdirectory.