1#!/bin/bash 2# Copyright 2024 Huawei Technologies Co., Ltd 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================ 16 17if [[ -n "${MS_INTERNAL_KERNEL_HOME}" ]]; then 18 echo "Use local MS_INTERNAL_KERNEL_HOME : ${MS_INTERNAL_KERNEL_HOME}" 19 return 20fi 21if [[ "$(uname)" != Linux || ("$(arch)" != x86_64 && "$(arch)" != aarch64) ]]; then 22 echo "[WARNING] Internal kernels only supports linux system, x86_64 or aarch64 CPU arch." 23 return 24fi 25file_path=${BASEPATH}/mindspore/ccsrc/plugin/device/ascend/kernel/internal/prebuild/$(arch) 26file_name=${file_path}/ms_kernels_internal.tar.gz 27if [[ ! -f "${file_name}" ]]; then 28 echo "[WARNING] The file ${file_name} does NOT EXIST." 29 return 30fi 31file_lines=`cat "${file_name}" | wc -l` 32if [[ ${file_lines} -eq 3 ]]; then 33 echo "[WARNING] The file ms_kernel_internal.tar.gz is not pulled. Please ensure git-lfs is installed by" 34 echo "[WARNING] 'git lfs install' and retry downloading using 'git lfs pull'." 35 return 36fi 37tar -zxf ${file_name} -C ${file_path} 38if [[ $? -ne 0 ]]; then 39 echo "[WARNING] Unzip ms_kernel_internal.tar.gz FAILED!" 40 return 41fi 42echo "Unzip ms_kernel_internal.tar.gz SUCCESS!" 43export MS_INTERNAL_KERNEL_HOME="${file_path}/ms_kernels_internal" 44echo "MS_INTERNAL_KERNEL_HOME = ${MS_INTERNAL_KERNEL_HOME}"