diff --git a/mllib-dal/build.sh b/mllib-dal/build.sh index 47b699728..eee3467b0 100755 --- a/mllib-dal/build.sh +++ b/mllib-dal/build.sh @@ -11,11 +11,18 @@ if [[ -z $(which mvn) ]]; then exit 1 fi -if [[ -z $DAALROOT ]]; then +if [[ -z $DAALROOT && -z $DALROOT ]]; then echo DAALROOT not defined! exit 1 fi +if [[ -e $DAALROOT ]]; then + export ONEDAL_VERSION=$(echo "$DAALROOT" | awk -F '/' '{print $(NF)}') +elif [[ -e $DALROOT ]]; then + export ONEDAL_VERSION=$(echo "$DALROOT" | awk -F '/' '{print $(NF)}') +fi +echo $ONEDAL_VERSION + if [[ -z $TBBROOT ]]; then echo TBBROOT not defined! exit 1 @@ -74,6 +81,7 @@ OAP_MLLIB_ROOT=$(cd $SCRIPT_DIR/.. && pwd) source $OAP_MLLIB_ROOT/RELEASE # Set default PLATFORM_PROFILE from RELEASE envs export PLATFORM_PROFILE=${PLATFORM_OPT:-$PLATFORM_PROFILE} +echo $PLATFORM_PROFILE echo @@ -89,7 +97,11 @@ then echo GCC Version: $(gcc -dumpversion) fi echo JAVA_HOME=$JAVA_HOME -echo DAALROOT=$DAALROOT +if [[ -e $DAALROOT ]]; then + echo DAALROOT=$DAALROOT +elif [[ -e $DALROOT ]]; then + echo DAALROOT=$DALROOT +fi echo TBBROOT=$TBBROOT echo CCL_ROOT=$CCL_ROOT echo ============================= diff --git a/mllib-dal/src/main/native/build-cpu-gpu.sh b/mllib-dal/src/main/native/build-cpu-gpu.sh index 81d591516..09ae89768 100755 --- a/mllib-dal/src/main/native/build-cpu-gpu.sh +++ b/mllib-dal/src/main/native/build-cpu-gpu.sh @@ -16,5 +16,4 @@ export PLATFORM_PROFILE=CPU_GPU_PROFILE -make clean -make -j +bash build.sh \ No newline at end of file diff --git a/mllib-dal/src/main/native/build.sh b/mllib-dal/src/main/native/build.sh index cfa1ef844..5529bd135 100755 --- a/mllib-dal/src/main/native/build.sh +++ b/mllib-dal/src/main/native/build.sh @@ -18,5 +18,54 @@ if [[ $OAP_MLLIB_TESTING == "true" ]]; then exit 0 fi -make clean -make -j +if [[ -z $ONEDAL_VERSION ]]; then + if [[ -e $DAALROOT ]]; then + export ONEDAL_VERSION=$(echo "$DAALROOT" | awk -F '/' '{print $(NF)}') + elif [[ -e $DALROOT ]]; then + export ONEDAL_VERSION=$(echo "$DALROOT" | awk -F '/' '{print $(NF)}') + else + echo DAALROOT not defined! + exit 1 + fi + echo $ONEDAL_VERSION +fi + +# Function to compare version strings +compare_versions() { + local v1=$1 + local v2=$2 + + # Convert versions to arrays + IFS='.' read -ra v1_array <<< "$v1" + IFS='.' read -ra v2_array <<< "$v2" + + # Iterate through each segment and compare numerically + for i in {0..2}; do + if ((v1_array[i] > v2_array[i])); then + return 0 # v1 > v2 + elif ((v1_array[i] < v2_array[i])); then + return 1 # v1 < v2 + fi + done + + return 1 # v1 == v2 +} + +# Reference version +reference_version="2023.2.0" + +# Compare versions +compare_versions "$ONEDAL_VERSION" "$reference_version" +result=$? + +# Check the result of the comparison +if [ "$result" -eq 0 ]; then + echo "$ONEDAL_VERSION is greater than $reference_version" + make clean + make -f Makefile -j +elif [ "$result" -eq 1 ]; then + echo "$ONEDAL_VERSION is less than or equal $reference_version" + make clean + make -f Makefile_2023.2.0 -j + +fi