I am working on parallelizing my sequential program using OpenMPI.
Although I got performance speedup using many threads, there was
slowdown on a small number of threads like 4 threads.
I found that it is because getc worked much slower than sequential
version. Does OpenMPI override or wrap getc function?
To find the cause, I added mpi.h to the program and compiled it with
mpicc. There are two versions on the program;
1. The sequential program without MPI_Init_thread and MPI_Finalize.
2. The sequential program with MPI_Init_thread and MPI_Finalize.
Version 2 was 4x slower than version 1. I think it is because of slow
getc. Does MPI_Init_thread have some relation with the getc function
Thank you in advance.