[demos] Improve steps of dependency preinstall
This commit is contained in:
		
							parent
							
								
									4c407e8f67
								
							
						
					
					
						commit
						5a03deb6b9
					
				
							
								
								
									
										20
									
								
								.github/workflows/demo_test.yml
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										20
									
								
								.github/workflows/demo_test.yml
									
									
									
									
										vendored
									
									
								
							| @ -231,8 +231,8 @@ jobs: | |||||||
|         container-name: ${{ github.job }} |         container-name: ${{ github.job }} | ||||||
|         build-envs: 'OCCLUM_RELEASE_BUILD=1' |         build-envs: 'OCCLUM_RELEASE_BUILD=1' | ||||||
| 
 | 
 | ||||||
|     - name: Build xgboost dependencies |     - name: Preinstall dependencies and build xgboost | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/xgboost && ./download_and_build_xgboost.sh" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/xgboost && ./preinstall_deps.sh && ./download_and_build_xgboost.sh" | ||||||
| 
 | 
 | ||||||
|     - name: Run xgboost test |     - name: Run xgboost test | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/xgboost && SGX_MODE=SIM make test" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/xgboost && SGX_MODE=SIM make test" | ||||||
| @ -525,7 +525,7 @@ jobs: | |||||||
|     - name: Run redis benchmark |     - name: Run redis benchmark | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/redis; SGX_MODE=SIM ./benchmark_glibc.sh" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/redis; SGX_MODE=SIM ./benchmark_glibc.sh" | ||||||
| 
 | 
 | ||||||
|   flink_test: |   Flink_test: | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v1 |     - uses: actions/checkout@v1 | ||||||
| @ -537,8 +537,8 @@ jobs: | |||||||
|         container-name: ${{ github.job }} |         container-name: ${{ github.job }} | ||||||
|         build-envs: 'OCCLUM_RELEASE_BUILD=1' |         build-envs: 'OCCLUM_RELEASE_BUILD=1' | ||||||
| 
 | 
 | ||||||
|     - name: Download flink |     - name: Preinstall dependencies and download flink | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/flink && ./download_flink.sh" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/flink && ./preinstall_deps.sh && ./download_flink.sh" | ||||||
| 
 | 
 | ||||||
|     - name: Run jobmanager on host |     - name: Run jobmanager on host | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/flink && SGX_MODE=SIM ./run_flink_jobmanager_on_host.sh" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/flink && SGX_MODE=SIM ./run_flink_jobmanager_on_host.sh" | ||||||
| @ -573,7 +573,7 @@ jobs: | |||||||
|     - name: Run cluster serving test |     - name: Run cluster serving test | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/cluster_serving; source ./environment.sh; SGX_MODE=SIM ./start-all.sh; ./push-image.sh" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/cluster_serving; source ./environment.sh; SGX_MODE=SIM ./start-all.sh; ./push-image.sh" | ||||||
| 
 | 
 | ||||||
|   enclave_ra_tls_test: |   Enclave_RA_TLS_test: | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v1 |     - uses: actions/checkout@v1 | ||||||
| @ -597,7 +597,7 @@ jobs: | |||||||
|         sleep ${{ env.nap_time }}; |         sleep ${{ env.nap_time }}; | ||||||
|         docker exec ${{ github.job }} bash -c "/usr/share/enclave-tls/samples/enclave-tls-client" || true |         docker exec ${{ github.job }} bash -c "/usr/share/enclave-tls/samples/enclave-tls-client" || true | ||||||
| 
 | 
 | ||||||
|   vault_test: |   Vault_test: | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v1 |     - uses: actions/checkout@v1 | ||||||
| @ -620,7 +620,7 @@ jobs: | |||||||
|         sleep ${{ env.nap_time }}; |         sleep ${{ env.nap_time }}; | ||||||
|         docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/golang/vault && ./run_occlum_vault_test.sh" |         docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/golang/vault && ./run_occlum_vault_test.sh" | ||||||
| 
 | 
 | ||||||
|   sofaboot_test: |   Sofaboot_test: | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v1 |     - uses: actions/checkout@v1 | ||||||
| @ -659,7 +659,7 @@ jobs: | |||||||
|         build-envs: 'OCCLUM_RELEASE_BUILD=1' |         build-envs: 'OCCLUM_RELEASE_BUILD=1' | ||||||
| 
 | 
 | ||||||
|     - name: Install OpenJDK 11 (Glibc) |     - name: Install OpenJDK 11 (Glibc) | ||||||
|       run: docker exec ${{ github.job }} bash -c "apt update && apt install -y openjdk-11-jdk" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/netty_ut && ./preinstall_deps.sh" | ||||||
| 
 | 
 | ||||||
|     - name: Download and compile netty unit test demos |     - name: Download and compile netty unit test demos | ||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/netty_ut && ./build.sh" |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/netty_ut && ./build.sh" | ||||||
| @ -767,7 +767,7 @@ jobs: | |||||||
|       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/python/flask; |       run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/python/flask; | ||||||
|             curl --cacert flask.crt -X GET https://localhost:4996/customer/1" |             curl --cacert flask.crt -X GET https://localhost:4996/customer/1" | ||||||
| 
 | 
 | ||||||
|   iperf2_test: |   Iperf2_test: | ||||||
|     runs-on: ubuntu-20.04 |     runs-on: ubuntu-20.04 | ||||||
|     steps: |     steps: | ||||||
|     - uses: actions/checkout@v1 |     - uses: actions/checkout@v1 | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								.github/workflows/hw_mode_test.yml
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										10
									
								
								.github/workflows/hw_mode_test.yml
									
									
									
									
										vendored
									
									
								
							| @ -342,8 +342,8 @@ jobs: | |||||||
|         container-name: ${{ github.job }} |         container-name: ${{ github.job }} | ||||||
|         build-envs: 'OCCLUM_RELEASE_BUILD=1' |         build-envs: 'OCCLUM_RELEASE_BUILD=1' | ||||||
| 
 | 
 | ||||||
|     - name: Build xgboost dependencies |     - name: Preinstall dependencies and build xgboost | ||||||
|       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/xgboost && ./download_and_build_xgboost.sh" |       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/xgboost && ./preinstall_deps.sh && ./download_and_build_xgboost.sh" | ||||||
| 
 | 
 | ||||||
|     - name: Run xgboost test |     - name: Run xgboost test | ||||||
|       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/xgboost && make test" |       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/xgboost && make test" | ||||||
| @ -985,8 +985,8 @@ jobs: | |||||||
|         container-name: ${{ github.job }} |         container-name: ${{ github.job }} | ||||||
|         build-envs: 'OCCLUM_RELEASE_BUILD=1' |         build-envs: 'OCCLUM_RELEASE_BUILD=1' | ||||||
| 
 | 
 | ||||||
|     - name: Download and build mysql |     - name: Preinstall dependencies and build mysql | ||||||
|       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./dl_and_build_mysql.sh" |       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./preinstall_deps.sh && ./dl_and_build_mysql.sh" | ||||||
| 
 | 
 | ||||||
|     - name: Run mysql server |     - name: Run mysql server | ||||||
|       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./run_mysql_server.sh" & |       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./run_mysql_server.sh" & | ||||||
| @ -1034,7 +1034,7 @@ jobs: | |||||||
|         build-envs: 'OCCLUM_RELEASE_BUILD=1' |         build-envs: 'OCCLUM_RELEASE_BUILD=1' | ||||||
| 
 | 
 | ||||||
|     - name: Install OpenJDK 11 (Glibc) |     - name: Install OpenJDK 11 (Glibc) | ||||||
|       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "apt update && apt install -y openjdk-11-jdk" |       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/netty_ut && ./preinstall_deps.sh" | ||||||
| 
 | 
 | ||||||
|     - name: Download and compile netty unit test demos |     - name: Download and compile netty unit test demos | ||||||
|       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/netty_ut && ./build.sh" |       run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/netty_ut && ./build.sh" | ||||||
|  | |||||||
| @ -1,11 +1,25 @@ | |||||||
| 1. Run the flink jobmanager | # Run Flink on Occlum | ||||||
|  | 
 | ||||||
|  | ### Preinstall dependencies | ||||||
|  | Related dependencies: openjdk-11 | ||||||
|  | ``` | ||||||
|  | ./preinstall_deps.sh | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Run the flink jobmanager | ||||||
|  | ``` | ||||||
| ./run_flink_jobmanager_on_host.sh | ./run_flink_jobmanager_on_host.sh | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| 2. Run the taskManager | ### Run the taskManager | ||||||
|  | ``` | ||||||
| ./run_flink_on_occlum_glibc.sh tm | ./run_flink_on_occlum_glibc.sh tm | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| 3. Run flink jobs example | ### Run flink jobs example | ||||||
|  | ``` | ||||||
| ./run_flink_on_occlum_glibc.sh task | ./run_flink_on_occlum_glibc.sh task | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| **Note:**   | **Note:**   | ||||||
| 1. If running the jobmanager in docker, please export the port 8081 and 6123 | 1. If running the jobmanager in docker, please export the port 8081 and 6123 | ||||||
|  | |||||||
| @ -1,16 +1,6 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| set -e | set -e | ||||||
| 
 | 
 | ||||||
| OS=`awk -F= '/^NAME/{print $2}' /etc/os-release` |  | ||||||
| if [ "$OS" == "\"Ubuntu\"" ]; then |  | ||||||
|   apt-get update -y && apt-get install -y openjdk-11-jre |  | ||||||
|   # The openjdk has a broken symlink, remove it as a workaround |  | ||||||
|   rm -f /usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs |  | ||||||
| else |  | ||||||
|   echo "Unsupported OS: $OS" |  | ||||||
|   exit 1 |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| rm -rf flink-1.10.1* | rm -rf flink-1.10.1* | ||||||
| wget https://archive.apache.org/dist/flink/flink-1.10.1/flink-1.10.1-bin-scala_2.11.tgz | wget https://archive.apache.org/dist/flink/flink-1.10.1/flink-1.10.1-bin-scala_2.11.tgz | ||||||
| tar -xvzf flink-1.10.1-bin-scala_2.11.tgz | tar -xvzf flink-1.10.1-bin-scala_2.11.tgz | ||||||
|  | |||||||
							
								
								
									
										14
									
								
								demos/flink/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										14
									
								
								demos/flink/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,14 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | OS=`awk -F= '/^NAME/{print $2}' /etc/os-release` | ||||||
|  | if [ "$OS" == "\"Ubuntu\"" ]; then | ||||||
|  |   apt-get update -y && apt-get install -y openjdk-11-jre | ||||||
|  |   # The openjdk has a broken symlink, remove it as a workaround | ||||||
|  |   rm -f /usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs | ||||||
|  | else | ||||||
|  |   echo "Unsupported OS: $OS" | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | echo "Install dependencies success" | ||||||
| @ -2,7 +2,13 @@ | |||||||
| 
 | 
 | ||||||
| [`MySQL`](https://www.mysql.com/) is a widely used open-source relational database management system (RDBMS). | [`MySQL`](https://www.mysql.com/) is a widely used open-source relational database management system (RDBMS). | ||||||
| 
 | 
 | ||||||
| ### Build and install | ### Preinstall dependencies | ||||||
|  | Related dependencies: libnuma-dev libboost-all-dev boost-1.77.0 | ||||||
|  | ``` | ||||||
|  | ./preinstall_deps.sh | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Download and build MySQL | ||||||
| ``` | ``` | ||||||
| ./dl_and_build_mysql.sh | ./dl_and_build_mysql.sh | ||||||
| ``` | ``` | ||||||
|  | |||||||
| @ -3,25 +3,6 @@ set -e | |||||||
| 
 | 
 | ||||||
| BLUE='\033[1;34m' | BLUE='\033[1;34m' | ||||||
| NC='\033[0m' | NC='\033[0m' | ||||||
| echo -e "${BLUE}Start installing dependencies.${NC}" |  | ||||||
| 
 |  | ||||||
| # Prepare environment |  | ||||||
| DEPS="libnuma-dev libboost-all-dev" |  | ||||||
| 
 |  | ||||||
| apt-get update |  | ||||||
| apt-get install -y ${DEPS} |  | ||||||
| 
 |  | ||||||
| BOOST="boost_1_77_0" |  | ||||||
| wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/${BOOST}.tar.bz2 |  | ||||||
| tar --bzip2 -xf ${BOOST}.tar.bz2 |  | ||||||
| pushd ${BOOST} |  | ||||||
| ./bootstrap.sh --prefix=/usr --with-python=python3 && |  | ||||||
| ./b2 stage -j4 threading=multi link=shared |  | ||||||
| ./b2 install threading=multi link=shared |  | ||||||
| popd |  | ||||||
| 
 |  | ||||||
| echo -e "${BLUE}Finish installing dependencies.${NC}" |  | ||||||
| 
 |  | ||||||
| echo -e "${BLUE}Start building mysql from src.${NC}" | echo -e "${BLUE}Start building mysql from src.${NC}" | ||||||
| 
 | 
 | ||||||
| # Download released tarball | # Download released tarball | ||||||
|  | |||||||
							
								
								
									
										29
									
								
								demos/mysql/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										29
									
								
								demos/mysql/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,29 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | BLUE='\033[1;34m' | ||||||
|  | NC='\033[0m' | ||||||
|  | echo -e "${BLUE}Start installing dependencies.${NC}" | ||||||
|  | 
 | ||||||
|  | DEPS="libnuma-dev libboost-all-dev" | ||||||
|  | 
 | ||||||
|  | OS=`awk -F= '/^NAME/{print $2}' /etc/os-release` | ||||||
|  | if [ "$OS" == "\"Ubuntu\"" ]; then | ||||||
|  |   apt-get update -y && apt-get install -y ${DEPS} | ||||||
|  |   # Install sysbench for benchmarking purpose | ||||||
|  |   apt-get install -y sysbench | ||||||
|  | else | ||||||
|  |   echo "Unsupported OS: $OS" | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | BOOST="boost_1_77_0" | ||||||
|  | wget https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/${BOOST}.tar.bz2 | ||||||
|  | tar --bzip2 -xf ${BOOST}.tar.bz2 | ||||||
|  | pushd ${BOOST} | ||||||
|  | ./bootstrap.sh --prefix=/usr --with-python=python3 && | ||||||
|  | ./b2 stage -j4 threading=multi link=shared | ||||||
|  | ./b2 install threading=multi link=shared | ||||||
|  | popd | ||||||
|  | 
 | ||||||
|  | echo -e "${BLUE}Finish installing dependencies.${NC}" | ||||||
| @ -4,17 +4,12 @@ set -e | |||||||
| GREEN='\033[1;32m' | GREEN='\033[1;32m' | ||||||
| NC='\033[0m' | NC='\033[0m' | ||||||
| 
 | 
 | ||||||
| echo -e "${GREEN}Install sysbench first${NC}" |  | ||||||
| 
 |  | ||||||
| # We use sysbench to test mysql, need to install it first |  | ||||||
| apt-get install -y sysbench |  | ||||||
| 
 |  | ||||||
| function run_benchmarks() | function run_benchmarks() | ||||||
| { | { | ||||||
|     WORKLOADS=("oltp_point_select" "oltp_write_only" "oltp_read_write") |     WORKLOADS=("oltp_point_select" "oltp_write_only" "oltp_read_write") | ||||||
|     for item in ${WORKLOADS[@]} |     for item in ${WORKLOADS[@]} | ||||||
|     do |     do | ||||||
|         echo "start to prepare for $item" |         echo "${GREEN}start to prepare for $item${NC}" | ||||||
|         sleep 3 |         sleep 3 | ||||||
|         sysbench /usr/share/sysbench/$item.lua\ |         sysbench /usr/share/sysbench/$item.lua\ | ||||||
|             --mysql-host='127.0.0.1'\ |             --mysql-host='127.0.0.1'\ | ||||||
| @ -26,7 +21,7 @@ function run_benchmarks() | |||||||
|             --rand-type=pareto\ |             --rand-type=pareto\ | ||||||
|             prepare |             prepare | ||||||
| 
 | 
 | ||||||
|         echo "start to run $item" |         echo "${GREEN}start to run $item${NC}" | ||||||
|         sleep 3 |         sleep 3 | ||||||
|         sysbench /usr/share/sysbench/$item.lua\ |         sysbench /usr/share/sysbench/$item.lua\ | ||||||
|             --mysql-host='127.0.0.1'\ |             --mysql-host='127.0.0.1'\ | ||||||
| @ -40,7 +35,7 @@ function run_benchmarks() | |||||||
|             --report-interval=10\ |             --report-interval=10\ | ||||||
|             run |             run | ||||||
| 
 | 
 | ||||||
|         echo "start to cleanup $item" |         echo "${GREEN}start to cleanup $item${NC}" | ||||||
|         sleep 3 |         sleep 3 | ||||||
|         sysbench /usr/share/sysbench/$item.lua\ |         sysbench /usr/share/sysbench/$item.lua\ | ||||||
|             --mysql-host='127.0.0.1'\ |             --mysql-host='127.0.0.1'\ | ||||||
|  | |||||||
| @ -1,13 +1,19 @@ | |||||||
| # A Simple netty unit test usage demo | # A Simple netty unit test usage demo | ||||||
| 
 | 
 | ||||||
| This project demonstrates how to verify the completeness of Netty on Occlum. | This demo demonstrates how to verify the completeness of Netty on Occlum. | ||||||
| 
 | 
 | ||||||
| 1. Download junit and related netty jars | ### 1. Preinstall dependencies | ||||||
|  | Related dependencies: OpenJDK 11 (Glibc) | ||||||
|  | ``` | ||||||
|  | ./preinstall_deps.sh | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### 2. Download junit and related netty jars | ||||||
| ``` | ``` | ||||||
| ./build.sh | ./build.sh | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| 2. Run `netty unit test ` on Occlum | ### 3. Run `netty unit test ` on Occlum | ||||||
| ``` | ``` | ||||||
| ./run_netty_ut_jdk11.sh | ./run_netty_ut_jdk11.sh | ||||||
| ``` | ``` | ||||||
|  | |||||||
| @ -1,10 +1,10 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| sudo apt-get update | set -e | ||||||
| sudo apt-get install openjdk-11-jdk |  | ||||||
| rm -rf /usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs |  | ||||||
| 
 | 
 | ||||||
| # Download netty testsuite, junit platform and related dependencies | # Download netty testsuite, junit platform and related dependencies | ||||||
| 
 | 
 | ||||||
| if [ ! -d "netty" ]; then | if [ ! -d "netty" ]; then | ||||||
|     wget -i ./ut-jar.url -P ./netty |     wget -i ./ut-jar.url -P ./netty | ||||||
| fi | fi | ||||||
|  | 
 | ||||||
|  | echo "Build Netty unit test success" | ||||||
|  | |||||||
							
								
								
									
										13
									
								
								demos/netty_ut/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										13
									
								
								demos/netty_ut/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,13 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | OS=`awk -F= '/^NAME/{print $2}' /etc/os-release` | ||||||
|  | if [ "$OS" == "\"Ubuntu\"" ]; then | ||||||
|  |   apt-get update -y && apt-get install -y openjdk-11-jdk | ||||||
|  |   rm -rf /usr/lib/jvm/java-11-openjdk-amd64/lib/security/blacklisted.certs | ||||||
|  | else | ||||||
|  |   echo "Unsupported OS: $OS" | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | echo "Install dependencies success" | ||||||
| @ -1,22 +1,28 @@ | |||||||
| # Use XGBoost in SGX with Occlum | # Use XGBoost in SGX with Occlum | ||||||
| 
 | 
 | ||||||
| Step 1: Download XGBoost and its dependencies, and then build XGBoost | ### Step 1: Preinstall dependencies | ||||||
|  | Related dependencies: python3-pip python3-setuptools kubernetes cmake | ||||||
|  | ``` | ||||||
|  | ./preinstall_deps.sh | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | ### Step 2: Download and build XGBoost | ||||||
| ``` | ``` | ||||||
| ./download_and_build_xgboost.sh | ./download_and_build_xgboost.sh | ||||||
| ``` | ``` | ||||||
| When completed, the resulting XGBoost can be found in `xgboost_src` directory. | When completed, the resulting XGBoost can be found in `xgboost_src` directory. | ||||||
| 
 | 
 | ||||||
| Step 2: To train data with XGBoost in a single process, run | ### Step 3: To train data with XGBoost in a single process, run | ||||||
| ``` | ``` | ||||||
| make test | make test | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Step 3: To train data with a two-node XGBoost cluster, run | ### Step 4: To train data with a two-node XGBoost cluster, run | ||||||
| ``` | ``` | ||||||
| make test-local-cluster | make test-local-cluster | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| Step 4 (Optional): To train data with XGBoost in a single process in Linux, run | ### Step 5 (Optional): To train data with XGBoost in a single process in Linux, run | ||||||
| ``` | ``` | ||||||
| make test-native | make test-native | ||||||
| ``` | ``` | ||||||
|  | |||||||
| @ -4,18 +4,6 @@ set -e | |||||||
| # Tell CMake to search for packages in Occlum toolchain's directory only | # Tell CMake to search for packages in Occlum toolchain's directory only | ||||||
| export PKG_CONFIG_LIBDIR=/usr/local/occlum/x86_64-linux-musl/lib | export PKG_CONFIG_LIBDIR=/usr/local/occlum/x86_64-linux-musl/lib | ||||||
| 
 | 
 | ||||||
| # Install the dependencies |  | ||||||
| OS=`awk -F= '/^NAME/{print $2}' /etc/os-release` |  | ||||||
| if [ "$OS" == "\"Ubuntu\"" ]; then |  | ||||||
|   apt-get update -y && apt-get install -y python3-pip python3-setuptools |  | ||||||
| else |  | ||||||
|   yum install -y python3-pip python3-setuptools |  | ||||||
| fi |  | ||||||
| pip3 install kubernetes |  | ||||||
| 
 |  | ||||||
| #install the cmake |  | ||||||
| ./install_cmake.sh |  | ||||||
| 
 |  | ||||||
| # Download and build XGBoost | # Download and build XGBoost | ||||||
| rm -rf xgboost_src && mkdir xgboost_src | rm -rf xgboost_src && mkdir xgboost_src | ||||||
| pushd xgboost_src | pushd xgboost_src | ||||||
|  | |||||||
| @ -12,3 +12,5 @@ cd cmake-3.15.5 | |||||||
| ./bootstrap | ./bootstrap | ||||||
| make -j$(nproc) | make -j$(nproc) | ||||||
| sudo make install | sudo make install | ||||||
|  | 
 | ||||||
|  | echo "Install CMake success" | ||||||
|  | |||||||
							
								
								
									
										19
									
								
								demos/xgboost/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										19
									
								
								demos/xgboost/preinstall_deps.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,19 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | # Tell CMake to search for packages in Occlum toolchain's directory only | ||||||
|  | export PKG_CONFIG_LIBDIR=/usr/local/occlum/x86_64-linux-musl/lib | ||||||
|  | 
 | ||||||
|  | # Install dependencies | ||||||
|  | OS=`awk -F= '/^NAME/{print $2}' /etc/os-release` | ||||||
|  | if [ "$OS" == "\"Ubuntu\"" ]; then | ||||||
|  |   apt-get update -y && apt-get install -y python3-pip python3-setuptools | ||||||
|  | else | ||||||
|  |   yum install -y python3-pip python3-setuptools | ||||||
|  | fi | ||||||
|  | pip3 install kubernetes | ||||||
|  | 
 | ||||||
|  | echo "Install dependencies success" | ||||||
|  | 
 | ||||||
|  | # Install CMake | ||||||
|  | ./install_cmake.sh | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user