Skip to content

Commit

Permalink
Merge branch 'dev-2.0.0-beta' into dev-2.0.0-benchmark-verify
Browse files Browse the repository at this point in the history
  • Loading branch information
talkingwallace committed Sep 11, 2023
2 parents 43adbbf + c0ce4c0 commit 76f1f86
Show file tree
Hide file tree
Showing 13 changed files with 1,657 additions and 38 deletions.
745 changes: 745 additions & 0 deletions deploy/cluster-deploy/allinone/fate-allinone_deployment_guide.zh.md

Large diffs are not rendered by default.

529 changes: 529 additions & 0 deletions deploy/cluster-deploy/allinone/fate-exchange_deployment_guide.zh.md

Large diffs are not rendered by default.

158 changes: 158 additions & 0 deletions deploy/standalone-deploy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# FATE Single-Node Deployment Guide

[中文](./README.zh.md)

## 1. Introduction

**Server Configuration:**

- **Quantity:** 1
- **Configuration:** 8 cores / 16GB memory / 500GB hard disk
- **Operating System:** CentOS Linux release 7
- **User:** User: app owner:apps

The single-node version provides 3 deployment methods, which can be selected based on your needs:

- Install FATE using Docker Images
- Install FATE on the host machine (using pre-compiled installation packages)

## 2. Install FATE using Docker Images (Recommended)

It is recommended to use Docker images to greatly reduce the likelihood of encountering problems.

**Note:** Replace `${version}` in the examples below with the actual version number.

### 2.1 Pre-deployment Environment Check

- The host machine should have access to the external network to pull installation packages and Docker images from public networks.
- Dependency on [Docker](https://download.docker.com/linux/). Docker version 18.09 is recommended. You can verify the Docker environment using the following command: `docker --version`. For Docker start/stop and other operations, refer to `docker --help`.
- Before execution, check if port 8080 is already occupied. If you need to re-execute, use Docker commands to delete previous containers and images.

Set the necessary environment variables for deployment (note that environment variables set in this way are only valid for the current terminal session. If you open a new terminal session, such as logging in again or opening a new window, you will need to reset them).

```bash
export version={FATE version number for this deployment, e.g., 2.0.0-beta}
```

Example:

```bash
export version=2.0.0-beta
```

### 2.2 Pull Docker Images

#### 2.2.1 Via Public Image Services

```bash
# Docker Hub
docker pull federatedai/standalone_fate:${version}

# Tencent Cloud Container Image
docker pull ccr.ccs.tencentyun.com/federatedai/standalone_fate:${version}
docker tag ccr.ccs.tencentyun.com/federatedai/standalone_fate:${version} federatedai/standalone_fate:${version}
```

#### 2.2.2 Via Image Package

```bash
wget https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate/${version}/release/standalone_fate_docker_image_${version}_release.tar.gz
docker load -i standalone_fate_docker_image_${version}_release.tar.gz
docker images | grep federatedai/standalone_fate
```

If you see an image corresponding to `${version}`, it means the image download was successful.

### 2.3 Start

```bash
docker run -it --name standalone_fate -p 8080:8080 federatedai/standalone_fate:${version}
```

### 2.4 Testing

```bash
source /data/projects/fate/fate_flow/bin/init_env.sh
```

- [Test Items](#4-Test-Items)

## 3. Install FATE on the Host Machine (Using Pre-Compiled Installation Packages)

**Note:** Replace `${version}` in the examples below with the actual version number.

### 3.1 Pre-deployment Environment Check

Check if local ports 8080, 9360, and 9380 are already occupied.

```bash
netstat -apln|grep 8080;
netstat -apln|grep 9360;
netstat -apln|grep 9380
```

Because operating system dependencies need to be installed, root privileges are required. You can execute the subsequent operations as the root user. If you don't use the root user, grant sudo privileges to the user you want to use:

```bash
echo "{username to be used} ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/{username to be used}
```

### 3.2 Get Installation Package

Download the installation package and unpack it.

```bash
wget https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate/${version}/release/standalone_fate_install_${version}_release.tar.gz;
tar -xzvf standalone_fate_install_${version}_release.tar.gz
```

### 3.3 Installation

Navigate to the unpacked directory and use `bin/init.sh` for installation.

This script will automatically:

- Install necessary operating system dependency packages
- Install Python 3.6 environment
- Install Python package dependencies
- Install JDK environment
- Configure FATE environment variable scripts
- Configure FateFlow
- Configure Fateboard
- Install FATE client

```bash
cd standalone_fate_install_${version}_release;
bash bin/init.sh init
```

### 3.4 Start

```bash
bash bin/init.sh status
bash bin/init.sh start
```

### 3.5 Testing

- Load environment variables

```bash
source bin/init_env.sh
```

- [Test Items](#4-Test-Items)

## 4. Test Items

### 4.1 Toy Test

```bash
flow test toy -gid 10000 -hid 10000
```

If successful, the screen will display statements similar to the following:

```bash
toy test job xxx is success
```
158 changes: 158 additions & 0 deletions deploy/standalone-deploy/README.zh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# FATE 单机部署指南

[English](README.md)

## 1. 说明

**服务器配置:**

- **数量:** 1
- **配置:** 8 核 / 16GB 内存 / 500GB 硬盘
- **操作系统:** CentOS Linux release 7
- **用户:** User: app owner:apps

单机版提供 3 种部署方式,可以根据实际情况选择:

- 使用 Docker 镜像安装 FATE
- 在主机中安装 FATE (使用已编译的安装包)

## 2. 使用 Docker 镜像安装 FATE(推荐)

建议使用 Docker 镜像,这样可以大大降低遇到问题的可能性。

**注意:** 请使用实际的版本号替换示例中的 `${version}`

### 2.1 部署前环境检查

- 主机需要能够访问外部网络,从公共网络中拉取安装包和 Docker 镜像。
- 依赖 [docker](https://download.docker.com/linux/),Docker 建议版本为 18.09。您可以使用以下命令验证 Docker 环境:`docker --version`。有关 Docker 的起停和其他操作,请参考 `docker --help`
- 在执行之前,请检查端口 8080 是否已被占用。如果要重新执行,请使用 Docker 命令删除以前的容器和镜像。

设置部署所需环境变量(注意,通过以下方式设置的环境变量仅在当前终端会话中有效。如果打开新的终端会话,例如重新登录或打开新窗口,请重新设置)。

```bash
export version={本次部署的 FATE 版本号, 如 2.0.0-beta}
```

示例:

```bash
export version=2.0.0-beta
```

### 2.2 拉取镜像

#### 2.2.1 通过公共镜像服务

```bash
# Docker Hub
docker pull federatedai/standalone_fate:${version}

# 腾讯云容器镜像
docker pull ccr.ccs.tencentyun.com/federatedai/standalone_fate:${version}
docker tag ccr.ccs.tencentyun.com/federatedai/standalone_fate:${version} federatedai/standalone_fate:${version}
```

#### 2.2.2 通过镜像包

```bash
wget https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate/${version}/release/standalone_fate_docker_image_${version}_release.tar.gz
docker load -i standalone_fate_docker_image_${version}_release.tar.gz
docker images | grep federatedai/standalone_fate
```

如果您能看到对应 `${version}` 的镜像,则表示镜像下载成功。

### 2.3 启动

```bash
docker run -it --name standalone_fate -p 8080:8080 federatedai/standalone_fate:${version}
```

### 2.4 测试

```bash
source /data/projects/fate/fate_flow/bin/init_env.sh
```

- [测试项](#4-测试项)

## 3. 在主机中安装 FATE(使用已编译的安装包)

**注意:** 请使用实际的版本号替换示例中的 `${version}`

### 3.1 部署前环境检查

检查本地端口 8080、9360 和 9380 是否被占用。

```bash
netstat -apln|grep 8080;
netstat -apln|grep 9360;
netstat -apln|grep 9380
```

由于需要安装操作系统依赖包,所以需要 root 权限。您可以使用 root 用户执行后续操作,如果不使用 root 用户,请为要使用的用户分配 sudo 权限:

```bash
echo "{要使用的用户名} ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/{要使用的用户名}
```

### 3.2 获取安装包

下载安装包并解压缩。

```bash
wget https://webank-ai-1251170195.cos.ap-guangzhou.myqcloud.com/fate/${version}/release/standalone_fate_install_${version}_release.tar.gz;
tar -xzvf standalone_fate_install_${version}_release.tar.gz
```

### 3.3 安装

进入解压后的目录并使用 `bin/init.sh` 进行安装。

该脚本将自动完成以下任务:

- 安装必要的操作系统依赖包
- 安装 Python 3.6 环境
- 安装 Python 包依赖
- 安装 JDK 环境
- 配置 FATE 环境变量脚本
- 配置 FateFlow
- 配置 Fateboard
- 安装 FATE 客户端

```bash
cd standalone_fate_install_${version}_release;
bash bin/init.sh init
```

### 3.4 启动

```bash
bash bin/init.sh status
bash bin/init.sh start
```

### 3.5 测试

- 加载环境变量

```bash
source bin/init_env.sh
```

- [测试项](#4-测试项)

## 4. 测试项

### 4.1 Toy 测试

```bash
flow test toy -gid 10000 -hid 10000
```

如果成功,屏幕将显示类似下方的语句:

```bash
toy test job xxx is success
```
3 changes: 1 addition & 2 deletions doc/2.0/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#### 文档索引
- [FATE Flow V2.0 Quick Start](https://github.com/FederatedAI/FATE-Flow/blob/v2.0.0-beta/doc/quick_start.md)
- [FATE V2.0 Quick Start](./quick_start.md)
- [FATE Flow V2.0 Quick Start](https://github.com/FederatedAI/FATE-Flow/blob/v2.0.0-alpha/doc/quick_start.md)
- [FATE FLOW V2.0 方案](https://github.com/FederatedAI/FATE-Flow/blob/v2.0.0-alpha/doc/2.0.0-alpha.md)
- [OSX方案](./osx/osx.md)
- [FATE Components](./components)
6 changes: 3 additions & 3 deletions examples/pipeline/data_split/test_data_split_stratified.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ def main(config="../config.yaml", namespace=""):
data_split_1 = DataSplit("data_split_1",
train_size=200,
test_size=50,
stratified=False,
hetero_sync=False,
input_data=psi_0.outputs["output_data"]
stratified=True,
hetero_sync=True,
input_data=psi_1.outputs["output_data"]
)

pipeline.add_task(psi_0)
Expand Down
15 changes: 15 additions & 0 deletions python/fate/arch/context/_cipher.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def __init__(self, device: device, cipher_mapping: typing.Optional[dict] = None)
self._cipher_mapping = {}
else:
self._cipher_mapping = cipher_mapping
self._allow_custom_random_seed = False
self._custom_random_seed = 42

def set_phe(self, device: device, options: typing.Optional[dict]):
if "phe" not in self._cipher_mapping:
Expand All @@ -53,6 +55,19 @@ def phe(self):
raise ValueError(f"no impl exists for device {self._device}")
return PHECipherBuilder(**self._cipher_mapping["phe"][self._device])

@property
def allow_custom_random_seed(self):
return self._allow_custom_random_seed

def set_allow_custom_random_seed(self, allow_custom_random_seed):
self._allow_custom_random_seed = allow_custom_random_seed

def set_custom_random_seed(self, custom_random_seed):
self._custom_random_seed = custom_random_seed

def get_custom_random_seed(self):
return self._custom_random_seed


class PHECipherBuilder:
def __init__(self, kind, key_length) -> None:
Expand Down
Loading

0 comments on commit 76f1f86

Please sign in to comment.