javamultithreadinggradlebuild.gradlempj-express

How to pass -np argument to MPJ in gradle?


I was trying to do something with MPJ Express(My home work) and i couldn't find how to pass -np argument to MPJRun.

group 'ST1'
version '1.0-SNAPSHOT'

apply plugin:  'application'

mainClassName = 'example.Main'
sourceCompatibility = 1.8
def mpjHome = System.getenv( 'MPJ_HOME')
def mpjStarter =  files("$mpjHome/lib/starter.jar")
def mpjJar = files("$mpjHome/lib/mpj.jar ")
def mpjClasspath = sourceSets.main.runtimeClasspath - mpjJar

dependencies {
    compile mpjJar
}

run{
    main = 'runtime.starter.MPJRun'
    classpath = mpjStarter
    args  '-np 2' ,mainClassName, '-cp' , mpjClasspath.asPath
    dependsOn classes
}

Solution

  • Your args line should looks like: args '-np', 2 ,mainClassName, '-cp' , mpjClasspath.asPath

    movie which shows config in gradle: https://www.youtube.com/watch?v=gj-3Td6ZOyc&t=942s