Quantcast
Channel: プログラミング
Viewing all articles
Browse latest Browse all 8562

UCC(Unified Communication X) - Sabrou-mal サブロウ丸

$
0
0

集団通信を効率化するための低レベルな通信レイヤ。

./src
|-- coll_patterns  -----  集団通信パターンの実装(例: リング、ツリーベースの通信など)
|-- coll_score  --------  集団通信のスコアリング(性能評価)を行うロジック
|-- components
|   |-- base
|   |-- cl  ------------  集団通信(Collectives Layer)の実装(例: basic, hier, doca_urom)
|   |   |-- basic
|   |   |-- doca_urom  -  NVIDIA DOCA(Data Center on a Chip Architecture)向けのプラグイン
|   |   `-- hier  ------  階層的アルゴリズム
|   |-- ec  ------------  エラーコレクション(Error Collection)関連(例: base, cpu, cuda, rocm)
|   |-- mc  ------------  メモリコピー(Memory Copy)関連(例: base, cpu, cuda, rocm)
|   |-- tl  ------------  通信レイヤ(Transport Layer)の実装
|   |   |-- cuda
|   |   |   |-- allgather
|   |   |   |-- ...
|   |   |   `-- reduce_scatterv
|   |   |-- mlx5
|   |   |   |-- alltoall
|   |   |   `-- mcast
|   |   |       `-- p2p
|   |   |-- nccl
|   |   |   `-- allgatherv
|   |   |-- rccl
|   |   |   `-- allgatherv
|   |   |-- self
|   |   |-- sharp
|   |   `-- ucp  -------  OpenUCXコンポーネントで、低レイテンシかつ高スループットの通信を実現するための抽象化された通信レイヤ
|   |       |-- coll_plugins
|   |       |   `-- example
|   |       |-- allgather
|   |       |-- ...
|   |       `-- scatterv
|   `-- topo
|-- core  --------------  UCCのコアロジック(初期化、終了処理、基本的な操作)
|-- schedule  ----------  集団通信操作のスケジューリングロジック
|-- ucc  ---------------  api: UCCの外部API(アプリケーションが利用するインターフェース)
|   `-- api
`-- utils
    |-- arch  ----------  arch: CPUアーキテクチャ(例: x86_64, aarch64)に特化した実装
    `-- profile  -------  プロファイリング関連コード

ROCm(Radeon Open Compute) は、AMDが開発したオープンソースの高性能コンピューティング(HPC)およびGPUコンピューティング向けのソフトウェアプラットフォーム

OpenMPIから呼び出す

仮想環境でテスト。

Dockerfile

FROM ubuntu:24.04
RUN apt update
RUNDEBIAN_FRONTEND=noninteractive TZ=Asia/Tokyo apt install -y tzdata build-essential openssh-server vim git flex zlib1g zlib1g-dev autoconf automake libtool libnuma1
RUNrm-rf /var/lib/apt/lists/*

RUNmkdir /var/run/sshd
RUNecho'root:tmp'| chpasswd
RUNecho'PermitRootLogin yes'>> /etc/ssh/sshd_config
RUNecho'PasswordAuthentication yes'>> /etc/ssh/sshd_config

WORKDIR /app

RUN git clone https://github.com/openucx/ucx.git
RUNcd ucx && ./autogen.sh && ./configure --prefix=/usr && make -j&& make install

RUN git clone https://github.com/openucx/ucc.git
RUNcd ucc && ./autogen.sh && ./configure --prefix=/usr && make -j&& make install

RUN git clone https://github.com/open-mpi/ompi.git
RUNcd ompi && git submodule update --init--recursive&& ./autogen.pl && ./configure --with-ucx--with-ucc--prefix=/usr && make -j&& make install

CMD["/usr/sbin/sshd", "-D"]
docker build -f Dockerfile . -t ompi_dev:latest
docker run -d -shm-size 1g --name ompi_dev ompi_dev:latest

コンテナ作成時に、共有メモリ(shared memory)を増やプログラムの実行でエラーが。

Cのテストコード

#include <mpi.h>#include <stdio.h>#include <stdlib.h>#include <assert.h>intmain(int argc, char** argv) {
    int rank, size;
    int send_data, *recv_data;
    int error_code;

    MPI_Init(&argc, &argv);
    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);

    send_data = rank + 1;
    recv_data = (int*)malloc(size * sizeof(int));

    MPI_Allgather(&send_data, 1, MPI_INT, recv_data, 1, MPI_INT, MPI_COMM_WORLD);

    printf("Rank %d received data: ", rank);
    for (int i = 0; i < size; i++) printf("%d", recv_data[i]);
    printf("\n");

    free(recv_data);
    MPI_Finalize();

    return0;
}

実行コマンド

mpicc test_allgather.c
OMPI_MCA_coll_ucc_enable=1 OMPI_MCA_coll_ucc_priority=100 UCC_LOG_LEVEL=debug mpirun --allow-run-as-root -n 8 ./a.out 

もしくは

mpicc test_allgather.c
UCC_LOG_LEVEL=debug mpirun --allow-run-as-root -n 8 --mca coll_ucc_enable 1 --mca coll_ucc_priority 100 ./a.out 

参考

直接的な参考ではないですが、下記の連載が勉強になる。

freak-da.hatenablog.com


Viewing all articles
Browse latest Browse all 8562

Trending Articles