Sorry if this is a stupid question but I just want to know whats the actual meaning of the if statement below.
int rank, numprocs;
MPI_Status status;
MPI_Init(&argc,&argv);
MPI_Comm_size( MPI_COMM_WORLD, &numprocs );
MPI_Comm_rank( MPI_COMM_WORLD, &rank );
if( numprocs&(numprocs-1) )
{
if( rank==0 ) printf( "numprocs must be a power of 2.\n" );
MPI_Finalize();
return EXIT_FAILURE;
}
I was told that "numprocs&(numprocs-1)" is used to check if the numprocs is the power of 2, but how does it work actually? What is the output of the statement? Is it boolean or int?
Thanks.