|
| 1 | +From 7f7a3d65541828d9889bfdec799bc23339e8e520 Mon Sep 17 00:00:00 2001 |
| 2 | +From: YongZhuIntel <yong.zhu@intel.com> |
| 3 | +Date: Wed, 21 May 2025 09:37:06 +0800 |
| 4 | +Subject: [PATCH] oneccl align global V0.1.1 |
| 5 | + |
| 6 | +base on public branch release/ccl_2021.15.3-arc(def870543749186b6f38cdc865b44d52174c7492) |
| 7 | + |
| 8 | +Build: |
| 9 | + 1. mkdir build; cd build |
| 10 | + 2. source /opt/intel/oneapi/setvars.sh |
| 11 | + 3. export IGC_VISAOptions=-activeThreadsOnlyBarrier |
| 12 | + 4. cmake .. -DCMAKE_INSTALL_PREFIX=_install -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DCOMPUTE_BACKEND=dpcpp -DCCL_ENABLE_ARCB=1 && make -j && make install |
| 13 | + |
| 14 | +print bandwidth in benchmark |
| 15 | +--- |
| 16 | + examples/benchmark/include/benchmark.hpp | 40 +++++++++++++++++++++--- |
| 17 | + examples/benchmark/src/benchmark.cpp | 7 +++-- |
| 18 | + 2 files changed, 41 insertions(+), 6 deletions(-) |
| 19 | + |
| 20 | +diff --git a/examples/benchmark/include/benchmark.hpp b/examples/benchmark/include/benchmark.hpp |
| 21 | +index 08a3625..bff6275 100644 |
| 22 | +--- a/examples/benchmark/include/benchmark.hpp |
| 23 | ++++ b/examples/benchmark/include/benchmark.hpp |
| 24 | +@@ -377,7 +377,9 @@ void store_to_csv(const user_options_t& options, |
| 25 | + double max_time, |
| 26 | + double avg_time, |
| 27 | + double stddev, |
| 28 | +- double wait_avg_time) { |
| 29 | ++ double wait_avg_time, |
| 30 | ++ double algbw, |
| 31 | ++ double busbw) { |
| 32 | + std::ofstream csvf; |
| 33 | + csvf.open(options.csv_filepath, std::ofstream::out | std::ofstream::app); |
| 34 | + |
| 35 | +@@ -396,7 +398,7 @@ void store_to_csv(const user_options_t& options, |
| 36 | + << "," << ccl::get_datatype_size(dtype) << "," << elem_count << "," |
| 37 | + << ccl::get_datatype_size(dtype) * elem_count << "," << buf_count << "," |
| 38 | + << iter_count << "," << min_time << "," << max_time << "," << avg_time << "," |
| 39 | +- << stddev << "," << wait_avg_time << std::endl; |
| 40 | ++ << stddev << "," << wait_avg_time << "," << algbw << "," << busbw << std::endl; |
| 41 | + } |
| 42 | + csvf.close(); |
| 43 | + } |
| 44 | +@@ -472,13 +474,41 @@ void print_timings(const ccl::communicator& comm, |
| 45 | + max_time /= iter_count; |
| 46 | + |
| 47 | + size_t bytes = elem_count * ccl::get_datatype_size(dtype) * buf_count; |
| 48 | ++ |
| 49 | ++ double algbw = bytes*1000/total_avg_time/1024/1024; |
| 50 | ++ |
| 51 | ++ if (ncolls == 1) { |
| 52 | ++ if (options.coll_names.front() == "allgather" || |
| 53 | ++ options.coll_names.front() == "allgatherv" || |
| 54 | ++ options.coll_names.front() == "reducescatter" || |
| 55 | ++ options.coll_names.front() == "alltoall" || |
| 56 | ++ options.coll_names.front() == "alltoallv") { |
| 57 | ++ algbw = algbw * nranks; |
| 58 | ++ } |
| 59 | ++ } |
| 60 | ++ |
| 61 | ++ double busbw = algbw; |
| 62 | ++ if (ncolls == 1) { |
| 63 | ++ if (options.coll_names.front() == "allreduce") { |
| 64 | ++ busbw = algbw * 2 * (nranks -1) / nranks; |
| 65 | ++ } else if (options.coll_names.front() == "allgather" || |
| 66 | ++ options.coll_names.front() == "allgatherv" || |
| 67 | ++ options.coll_names.front() == "reducescatter" || |
| 68 | ++ options.coll_names.front() == "alltoall" || |
| 69 | ++ options.coll_names.front() == "alltoallv") { |
| 70 | ++ busbw = algbw * (nranks -1) / nranks; |
| 71 | ++ } |
| 72 | ++ } |
| 73 | ++ |
| 74 | + std::stringstream ss; |
| 75 | + ss << std::right << std::fixed << std::setw(COL_WIDTH) << bytes << std::setw(COL_WIDTH) |
| 76 | + << elem_count * buf_count << std::setw(COL_WIDTH) << iter_count << std::setw(COL_WIDTH) |
| 77 | + << std::setprecision(COL_PRECISION) << min_time << std::setw(COL_WIDTH) |
| 78 | + << std::setprecision(COL_PRECISION) << max_time << std::setw(COL_WIDTH) |
| 79 | + << std::setprecision(COL_PRECISION) << total_avg_time << std::setw(COL_WIDTH - 3) |
| 80 | +- << std::setprecision(COL_PRECISION) << stddev << std::setw(COL_WIDTH + 3); |
| 81 | ++ << std::setprecision(COL_PRECISION) << stddev << std::setw(COL_WIDTH) |
| 82 | ++ << std::setprecision(COL_PRECISION) << algbw << std::setw(COL_WIDTH) |
| 83 | ++ << std::setprecision(COL_PRECISION) << busbw << std::setw(COL_WIDTH + 3); |
| 84 | + |
| 85 | + if (show_extened_info(options.show_additional_info)) { |
| 86 | + ss << std::right << std::fixed << std::setprecision(COL_PRECISION) << wait_avg_time; |
| 87 | +@@ -497,7 +527,9 @@ void print_timings(const ccl::communicator& comm, |
| 88 | + max_time, |
| 89 | + total_avg_time, |
| 90 | + stddev, |
| 91 | +- wait_avg_time); |
| 92 | ++ wait_avg_time, |
| 93 | ++ algbw, |
| 94 | ++ busbw); |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | +diff --git a/examples/benchmark/src/benchmark.cpp b/examples/benchmark/src/benchmark.cpp |
| 99 | +index d90fb9b..78957f2 100644 |
| 100 | +--- a/examples/benchmark/src/benchmark.cpp |
| 101 | ++++ b/examples/benchmark/src/benchmark.cpp |
| 102 | +@@ -105,7 +105,8 @@ void run(ccl::communicator& service_comm, |
| 103 | + << "#elem_count" << std::setw(COL_WIDTH) << "#repetitions" |
| 104 | + << std::setw(COL_WIDTH) << "t_min[usec]" << std::setw(COL_WIDTH) << "t_max[usec]" |
| 105 | + << std::setw(COL_WIDTH) << "t_avg[usec]" << std::setw(COL_WIDTH - 3) |
| 106 | +- << "stddev[%]"; |
| 107 | ++ << "stddev[%]" << std::setw(COL_WIDTH) << "algbw[GB/s]" << std::setw(COL_WIDTH) |
| 108 | ++ << "busbw[GB/s]"; |
| 109 | + |
| 110 | + if (show_extened_info(options.show_additional_info)) { |
| 111 | + ss << std::right << std::setw(COL_WIDTH + 3) << "wait_t_avg[usec]"; |
| 112 | +@@ -435,7 +436,9 @@ int main(int argc, char* argv[]) { |
| 113 | + << "t_max[usec]," |
| 114 | + << "t_avg[usec]," |
| 115 | + << "stddev[%]," |
| 116 | +- << "wait_t_avg[usec]" << std::endl; |
| 117 | ++ << "wait_t_avg[usec]," |
| 118 | ++ << "algbw[GB/s]," |
| 119 | ++ << "busbw[GB/s]" << std::endl; |
| 120 | + csvf.close(); |
| 121 | + } |
| 122 | + |
| 123 | +-- |
| 124 | +2.25.1 |
| 125 | + |
0 commit comments