adding openmp code with nthreads in fprintf as well