             // boundaries
             cudaMemcpy(Un_h, Un_d, nx*ny*nlayers*4*sizeof(float), cudaMemcpyDeviceToHost);
             //bcs_fv(Un_h, nx, ny, nlayers, ng);
-            bcs_mpi(Un_h, nx, ny, nlayers, ng, comm, status, rank, n_processes);
+            if (n_processes == 1) {
+                bcs_fv(Un_h, nx, ny, nlayers, ng);
+            } else {
+                bcs_mpi(Un_h, nx, ny, nlayers, ng, comm, status, rank, n_processes);
+            }
             cudaMemcpy(Un_d, Un_h, nx*ny*nlayers*4*sizeof(float), cudaMemcpyHostToDevice);
 
 

                        MPI_Recv(buf, nlayers*nx*ny*4, MPI_FLOAT, source, tag, comm, &status);

                        // copy data back to grid
                        ky_offset = kernels[0].y*rank;

                        // cheating slightly and using the fact that are moving from  left to right to make calculations a bit easier.
                        for (int y = ky_offset*threads[0].y*blocks[0].y; y < ny; y++) {
                            for (int x = 0; x < nx; x++) {
                                for (int l = 0; l < nlayers; l++) {
                                    for (int i = 0; i < 4; i++) {

    cudaGetDevice(&device);
    cudaGetDeviceProperties(&prop, device);

    int total = (nx - 2*ng) * (ny - 2*ng) * nlayers;

    int kernels_x = 0;
    int kernels_y = 0;
