
Just bought a 2007 Toyato Yaris Hatchback. It is small, but ridiculously has large room even for my mountain bike. It is so efficient, 40MPG for me including local and highway (half and half).
Just another weblog!Note: This blog has been moved to [haolu.wordpress.com]. However, some old posts can be better viewed here.
if (rank == 0) then
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 1, tag, MPI_COMM_WORLD, ierr)
elseif (rank == 1) then
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
endif
if (rank == 0) then
call MPI_Send(..., 1, tag, MPI_COMM_WORLD, ierr)
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
elseif (rank == 1) then
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
endif
if (rank == 0) then
call MPI_Send(..., 1, tag, MPI_COMM_WORLD, ierr)
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
elseif (rank == 1) then
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
endif
if (rank == 0) then
call MPI_Isend(..., 1, tag, MPI_COMM_WORLD, req, ierr)
call MPI_Recv(..., 1, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Wait(req, status)
elseif (rank == 1) then
call MPI_Recv(..., 0, tag, MPI_COMM_WORLD, status, ierr)
call MPI_Send(..., 0, tag, MPI_COMM_WORLD, ierr)
endif

Code can be used to test a machine, and also includes big-endian/little-endian converters (for float and double), which can be modified and included into C++.
Just copy the code into a file, for example “endiantest.c,” then compile it using “gcc endiantest.c,” and execute “a.out.”
Good luck!
Hao
#include <stdio.h>
float floatSWAP(float f)
{
union
{
float f;
unsigned char b[4];
} dat1, dat2;
dat1.f = f;
dat2.b[0] = dat1.b[3];
dat2.b[1] = dat1.b[2];
dat2.b[2] = dat1.b[1];
dat2.b[3] = dat1.b[0];
return dat2.f;
}
double doubleSWAP(double df)
{
union
{
double df;
unsigned char b[8];
} dat1, dat2;
dat1.df = df;
dat2.b[0] = dat1.b[7];
dat2.b[1] = dat1.b[6];
dat2.b[2] = dat1.b[5];
dat2.b[3] = dat1.b[4];
dat2.b[4] = dat1.b[3];
dat2.b[5] = dat1.b[2];
dat2.b[6] = dat1.b[1];
dat2.b[7] = dat1.b[0];
return dat2.df;
}
int IsBigEndian()
{
short int word = 0x0001;
char *byte = (char *) &word;
return (byte[0] ? 0:1);
}
float BEfloat(float f)
{
if (IsBigEndian())
return f;
else
return floatSWAP(f);
}
float LEfloat(float f)
{
if (IsBigEndian())
return floatSWAP(f);
else
return f;
}
double BEdouble(double df)
{
if (IsBigEndian())
return df;
else
return doubleSWAP(df);
}
double LEdouble(double df)
{
if (IsBigEndian())
return doubleSWAP(df);
else
return df;
}
int main(void)
{
float f, sf;
double df, sdf;
unsigned char * ch;
f = 32.45;
sf = floatSWAP(f);
printf("%f:%f\n%f\n",f,sf,BEfloat(f));
ch = (unsigned char *) &f;
printf("%1x%1x%1x%1x:",*ch,*(ch+1),*(ch+2),*(ch+3));
ch = (unsigned char *) &sf;
printf("%1x%1x%1x%1x\n\n",*ch,*(ch+1),*(ch+2),*(ch+3));
df = 10.23456789;
sdf = doubleSWAP(df);
printf("%13.10g:%13.10g\n%13.10g\n",df,sdf,BEdouble(df));
ch = (unsigned char *) &df;
printf("%1x%1x%1x%1x%1x%1x%1x%1x:",*ch,*(ch+1),*(ch+2),*(ch+3),*(ch+4),*(ch+5),*(ch+6),*(ch+7));
ch = (unsigned char *) &sdf;
printf("%1x%1x%1x%1x%1x%1x%1x%1x\n\n",*ch,*(ch+1),*(ch+2),*(ch+3),*(ch+4),*(ch+5),*(ch+6),*(ch+7));
if (IsBigEndian())
printf("This is Big-Endian machine.\n");
else
printf("This is Little-Endian machine.\n");
}
\begin{figure}[h!]
\begin{minipage}{0.5\textwidth}
\begin{tabular}{c}
\includegraphics[width=\textwidth]{SPU64.eps} \\
(a)
\end{tabular}
\end{minipage}
%\hfill
\begin{minipage}{0.5\textwidth}
\begin{tabular}{c}
\includegraphics[width=\textwidth]{SPW64.eps} \\
(b)
\end{tabular}
\end{minipage}
\caption{Normalized streamwise velocity spectra (a) and vertical velocity spectra (b) at different heights obtained from $64^3$ LES. Numbers in plots denote normalized heights ($z/H$).}
\label{fig:SP64}
\end{figure}