Skip to content
Jorge Navas edited this page Oct 20, 2021 · 3 revisions

Installing OCCAM's razor

razor is a pip package that relies on the same dynamic library as occam. So you should first build and install occam. razor provides the command line tool slash for end users. You can either install razor from this repository, or you can use:

pip install razor

To install an editable version from this repository:

make -f Makefile develop

This may require sudo privileges.

Using slash

Either way, you can now use slash:

slash [--work-dir=<dir>]  [--force] [--no-strip] [--intra-spec-policy=<type>] [--inter-spec-policy=<type>] [--use-pointer-analysis] [--enable-config-prime] [--config-prime-spec-only-globals] <manifest>

where

type=none|aggressive|nonrec-aggressive|bounded|onlyonce

The value none will prevent any intra- or inter-module specialization. The value aggressive specializes a call if any parameter is a constant. The value nonrec-aggressive specializes a call if the function is not recursive and any parameter is a constant. The value bounded makes at most k copies, where k can be chosen by option --max-bounded-spec. The value onlyonce makes a copy of a function only if the function is called exactly once.

The option use-pointer-analysis enables a more precise call graph and allows specialization of parameters whose values are function addresses.

The option enable-config-prime enables a customized version of the LLVM interpreter to perform dynamic analysis for propagating and capturing more precise deployment context information. The option config-prime-spec-only-globals ensures that Configuration Priming only specializes using only constants stored in global variables.

To function correctly, slash calls LLVM tools, such as opt and clang++. These should be available in your PATH, and be the currently supported version (10.0). Like wllvm, slash will pay attention to the environment variables LLVM_OPT_NAME and LLVM_CXX_NAME if your version of these tools is adorned with suffixes.

Logging

You can choose to record logs from OCCAM by setting the following variables:

  export OCCAM_LOGFILE={absolute path to log location}
  export OCCAM_LOGLEVEL={INFO, WARNING, or ERROR}
Clone this wiki locally