Skip to content

Commit

Permalink
Added 'j' option to use multiple cpus to build JNI library. (#2244) (#…
Browse files Browse the repository at this point in the history
…2245)

Signed-off-by: Dooyong Kim <[email protected]>
Co-authored-by: Dooyong Kim <[email protected]>
(cherry picked from commit a029fa8)

Co-authored-by: Doo Yong Kim <[email protected]>
  • Loading branch information
1 parent 1944783 commit 7d02040
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ function usage() {
echo -e "-p PLATFORM\t[Optional] Platform, ignored."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, ignored."
echo -e "-o OUTPUT\t[Optional] Output path, default is 'artifacts'."
echo -e "-j NPROC_COUNT\t[Optional] Number of CPUs to use when building JNI library. Default is 1."
echo -e "-h help"
}

while getopts ":h:v:q:s:o:p:a:" arg; do
while getopts ":h:v:q:s:o:p:a:j:" arg; do
case $arg in
h)
usage
Expand All @@ -45,6 +46,9 @@ while getopts ":h:v:q:s:o:p:a:" arg; do
a)
ARCHITECTURE=$OPTARG
;;
j)
NPROC_COUNT=$OPTARG
;;
:)
echo "Error: -${OPTARG} requires an argument"
usage
Expand Down Expand Up @@ -118,7 +122,7 @@ fi
# Build k-NN lib and plugin through gradle tasks
cd $work_dir
./gradlew build --no-daemon --refresh-dependencies -x integTest -x test -Dopensearch.version=$VERSION -Dbuild.snapshot=$SNAPSHOT -Dbuild.version_qualifier=$QUALIFIER -Dbuild.lib.commit_patches=false
./gradlew :buildJniLib -Davx512.enabled=false -Davx2.enabled=false -Dbuild.lib.commit_patches=false
./gradlew :buildJniLib -Davx512.enabled=false -Davx2.enabled=false -Dbuild.lib.commit_patches=false -Dnproc.count=${NPROC_COUNT:-1}

if [ "$PLATFORM" != "windows" ] && [ "$ARCHITECTURE" = "x64" ]; then
echo "Building k-NN library after enabling AVX2"
Expand Down

0 comments on commit 7d02040

Please sign in to comment.