#include #include #include "nodes_used.h" int main(int argc, char* argv[]) { int id, np, processor_name_len; char processor_name[MPI_MAX_PROCESSOR_NAME]; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &id); MPI_Comm_size(MPI_COMM_WORLD, &np); MPI_Get_processor_name(processor_name, &processor_name_len); FILE* log_fp = NULL; if (id == 0) { log_fp = fopen("nodes_used.log", "w"); } /* Log our MPI processes to the log file. We could also have specified the special FILE* names "stdout" or "stderr" here */ log_processes(log_fp, id, np, processor_name); if (id == 0) { fclose(log_fp); } MPI_Finalize(); return 0; }