Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
Signed-off-by: minmingzhu <minming.zhu@intel.com>
  • Loading branch information
minmingzhu committed Jan 22, 2024
1 parent d899a67 commit f84876c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
16 changes: 14 additions & 2 deletions mllib-dal/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 =============================
Expand Down
3 changes: 1 addition & 2 deletions mllib-dal/src/main/native/build-cpu-gpu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@

export PLATFORM_PROFILE=CPU_GPU_PROFILE

make clean
make -j
bash build.sh
53 changes: 51 additions & 2 deletions mllib-dal/src/main/native/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f84876c

Please sign in to comment.