opalopal-framework

OPAL-How to configure properties of project


While I'm running analysis(eg.CHADemo in OPAL source code), i always get warning as

[warn][OPAL] the property org.opalj.threads.CPUBoundTasks is unspecified

In former question, it suggested the config file in the Common project under /src/main/resources/reference.conf. So i try to add follow lines into the file, but still got the same warning.

org.opalj.threads{
    CPUBoundTasks = "8"
    IOBoundTasks = "8"
}

Besides, while i import OPAL as library in my project, and trying to create reference.conf in "/src/main/resources/" of my project. I have suffered same problem.


Solution

  • Those values are configured in config value that is considered at compile time of the project. The file you need is located in OPALs root directory. When you open the file local.sbt.template you will see the following:

    //
    // Optional configuration settings specific to each developers machine.
    //
    
    // If your CPU uses hyperthreading, it is recommended to specify the
    // number of physical cores and the number of hyperthreaded cores;
    // this will spead up the overall execution.
       javaOptions in ThisBuild ++= Seq(
     "-Dorg.opalj.threads.CPUBoundTasks=16", // Number of physical (not            hyperthreaded) cores/CPUs
     "-Dorg.opalj.threads.IOBoundTasks=32" // Number of (hyperthreaded) cores * 1,5
    )
    
    // If you want to disable assertions, uncomment the following line.
    // Assertions are heavily used throughout OPAL and have a
    // signifcant performance impact. However, at development time it is
    // HIGHLY recommend to turn on assertions!
    //scalacOptions in ThisBuild += "-Xdisable-assertions"
    
    //
    //scalacOptions in ThisBuild -= "-Ywarn-unused-import"
    //scalacOptions in ThisBuild -= "-Ywarn-unused"
    

    If you want to configure the number of used cores, remove the .template from the file name and adapt the values to your needs. Then you have to rebuild OPAL.