Broadcast the variabes in sub-grid parallelism
| 1183 | } |
| 1184 | // Broadcast the variabes in sub-grid parallelism |
| 1185 | int broadcast_variable_grids(int variable, lbann_comm* comm) |
| 1186 | { |
| 1187 | |
| 1188 | El::Int variable_local[1], recvMetaData[1]; |
| 1189 | if (comm->get_grid_type() == GridType::PRIMARY_GRID) { |
| 1190 | variable_local[0] = variable; |
| 1191 | } |
| 1192 | else if (comm->get_grid_type() == GridType::SECONDARY_GRID) { |
| 1193 | variable_local[0] = 0; |
| 1194 | } |
| 1195 | |
| 1196 | if (comm->get_grid_type() == GridType::PRIMARY_GRID or |
| 1197 | comm->get_grid_type() == GridType::SECONDARY_GRID) { |
| 1198 | El::SyncInfo<El::Device::CPU> syncGeneralCPU = |
| 1199 | El::SyncInfo<El::Device::CPU>(); |
| 1200 | El::mpi::AllReduce(variable_local, |
| 1201 | recvMetaData, |
| 1202 | 1, |
| 1203 | El::mpi::MAX, |
| 1204 | comm->get_combined_grid_comm(), |
| 1205 | syncGeneralCPU); |
| 1206 | return recvMetaData[0]; |
| 1207 | } |
| 1208 | else { |
| 1209 | return 0; |
| 1210 | } |
| 1211 | } |
| 1212 | |
| 1213 | // ============================================= |
| 1214 | // KFAC implementation |
no test coverage detected