[parsec-users] vips and fluidanimate on Solaris/SPARC

Major mbb45 at cornell.edu
Mon Jun 30 21:14:12 EDT 2008


Hi,

I noticed in the usergroups people had issues with vips unable to find 
certain libraries when compiled on Solar/SPARC. I modified the path so 
the parsec libc is read first before the system glibc, but that didnt 
solve the issue. The previous person in the newsgroup that had this 
issue didn't respond whether that fix had worked for them.

There was also an issue with fluidanimate reading in junk due to the 
bigendian little endian issues.
I implemented the fix that was mentioned below for bodytrack, and while 
the code compiles cleanly and is performing the swaps, it still didn't 
solve the problem problem (assert violation-at least for me).

Did anyone else solve these two issues? I'd like to make sure its my 
implementation that's the issue and not the underlying software/hardware.

Thanks,

-Major Bhadauria


Hi Kshitij,

You made a good observation. Fluidanimate loads its input data from a
file which is in binary format. In order to use the program it is
necessary to flip all loaded variables larger than 1 byte. That's not
difficult to do, I've already done that for bodytrack but haven't had
the time to fix the other programs. You can use the routines I wrote for
bodytrack in file FlexIO.cpp to get it to run correctly. Here they are:

//Detect endianness of this machine
bool isLittleEndian() {
  union {
    WORD word;
    BYTE byte;
  } endian_test;

  endian_test.word = 0x00FF;
  return (endian_test.byte == 0xFF);
}

//Invert the byte order of a 16-bit word
WORD swap_16(WORD x) {
  union {
    WORD x_16;
    BYTE x_8[2];
  } mem_array;
  BYTE temp;

  mem_array.x_16 = x;
  temp = mem_array.x_8[0];
  mem_array.x_8[0] = mem_array.x_8[1];
  mem_array.x_8[1] = temp;

  return mem_array.x_16;
}

//Invert the byte order of a 32-bit word
DWORD swap_32(DWORD x) {
  union {
    DWORD x_32;
    WORD x_16[2];
    BYTE x_8[4];
  } mem_array;
  BYTE temp;

  mem_array.x_32 = x;
  //swap outer bytes
  temp = mem_array.x_8[0];
  mem_array.x_8[0] = mem_array.x_8[3];
  mem_array.x_8[3] = temp;
  //swap inner bytes
  temp = mem_array.x_8[1];
  mem_array.x_8[1] = mem_array.x_8[2];
  mem_array.x_8[2] = temp;

  return mem_array.x_32;
}



You would use them as follows after you've loaded a value into a
variable (example also taken from FlexIO.cpp):


if(!isLittleEndian()) {
  bmfh->bfType = swap_16(bmfh->bfType);
  bmfh->bfSize = swap_32(bmfh->bfSize);
  bmfh->bfReserved1 = swap_16(bmfh->bfReserved1);
  bmfh->bfReserved2 = swap_16(bmfh->bfReserved2);
  bmfh->bfOffBits = swap_32(bmfh->bfOffBits);
}


Fluidanimate uses the file.read method to load data from file. I counted
11 occurrences. Simply convert it as follows as shown below. The code...

file.read((char *)&restParticlesPerMeter, 4);
file.read((char *)&origNumParticles, 4);
 
...would become...

file.read((char *)&restParticlesPerMeter, 4);
file.read((char *)&origNumParticles, 4);
if(!isLittleEndian()) {
  restParticlesPerMeter = swap_32(restParticlesPerMeter);
  origNumParticles = swap_32(origNumParticles);
}

Do the same where it reads the particles a little farther down and it
should work. If you get something to work please post a patch to this
mailing list.

- Chris



On Sat, 2008-04-12 at 14:25, Kshitij Sudan wrote:
>/ Hi Javier,
/>/ 
/>/ I also compiled fluidanimate but for Linux/SPARC with gcc-4.2 and even
/>/ though it compiles properly, it has portability issues (SPARC being
/>/ big endian). It dies giving the following error :
/>/ 
/>/ $ ./inst/sparc-linux.gcc/bin/fluidanimate 2 5 in_35K.fluid out.fluid
/>/ PARSEC Benchmark Suite Version 1.0
/>/ Loading file "in_35K.fluid"...
/>/ fluidanimate: parallel.cpp:177: void InitSim(const char*, unsigned
/>/ int): Assertion `nx >= 1 && ny >= 1 && nz >= 1' failed.
/>/ Aborted
/>/ $
/>/ 
/>/ Did you also run into these errors or you just compiled these
/>/ benchmarks and did not execute them?
/>/ 
/>/ thanks,
/>/ -Kshitij
/>/ 
/>/ 
/>/ On Thu, Apr 10, 2008 at 7:48 AM, Javier Lira <jlira at ac.upc.edu <https://lists.cs.princeton.edu/mailman/listinfo/parsec-users>> wrote:
/>/ > Hi,
/>/ >
/>/ >  You should modify the file config/gcc.bldconf to allow parsecmgmt to
/>/ >  find your compiler.
/>/ >
/>/ >  I have already compiled 7 of the Parsec workloads: blackscholes,
/>/ >  bodytrack, fluidanimate, streamcluster, swaptions, vips and x264 (this
/>/ >  one modifying something solaris specific).
/>/ >
/>/ >  The main problems I found were that the pthread library delivered with
/>/ >  Solaris 9 is not the one needed by Parsec. It will require Solaris 10
/>/ >  instead. And, as README file says, the gcc compiler should be at least
/>/ >  the 4.2.X version.
/>/ >
/>/ >  I hope my experience compiling that could help you. If someone else have
/>/ >  compiled some of the rest of the Parsec workloads for Solaris/Sparc
/>/ >  environment, please kindly tell your story to know how you do it.
/>/ >
/>/ >  Many thanks and best regards,
/>/ >
/>/ >  Javier
/>/ >
/>/ >
/>/ >
/>/ >  On Thu, 2008-04-10 at 12:07 +0000, Huan Fang wrote:
/>/ >  > Hello,
/>/ >  >
/>/ >  > I am trying to compile some programs for solaris/sparc, but it fails all
/>/ >  > the time. what I got is:
/>/ >  >
/>/ >  > [PARSEC] Warning: At least bash version 3 is recommended. Earlier
/>/ >  > versions might not function properly. Current version is 2.05.0(1)-release.
/>/ >  > ./parsecmgmt: /usr/bin/gcc: No such file or directory
/>/ >  > ./parsecmgmt: /usr/bin/g++: No such file or directory
/>/ >  > [PARSEC] Packages to build:  bodytrack
/>/ >  >
/>/ >  > [PARSEC] [========== Building package bodytrack ==========]
/>/ >  > [PARSEC] [---------- Analyzing package bodytrack ----------]
/>/ >  > [PARSEC] bodytrack depends on: hooks
/>/ >  > [PARSEC] [---------- Analyzing package hooks ----------]
/>/ >  > [PARSEC] hooks does not depend on any other packages.
/>/ >  > [PARSEC] [---------- Building package hooks ----------]
/>/ >  > [PARSEC] Removing old build directory.
/>/ >  > [PARSEC] Copying source code of package hooks.
/>/ >  > [PARSEC] Error: Cannot find Makefile in
/>/ >  > /parsec-1.0/bin/../pkgs/libs/hooks/obj/sparc-solaris.gcc
/>/ >  >
/>/ >  > I believe there are gcc/g++ in my system, but apparently it's not in
/>/ >  > /usr/bin.
/>/ >  > So how can I fix things up and which programs are verified to be
/>/ >  > successfully compiled on solaris?  Thanks a lot.
/>/ >  >
/>/ >  > Best Regards,
/>/ >  > Huan Fang
/>/ >  >
/>/ >  > _______________________________________________
/>/ >  > parsec-users mailing list
/>/ >  > parsec-users at lists.cs.princeton.edu <https://lists.cs.princeton.edu/mailman/listinfo/parsec-users>
/>/ >  > https://lists.cs.princeton.edu/mailman/listinfo/parsec-users
/>/ >
/>/ >  _______________________________________________
/>/ >  parsec-users mailing list
/>/ >  parsec-users at lists.cs.princeton.edu <https://lists.cs.princeton.edu/mailman/listinfo/parsec-users>
/>/ >  https://lists.cs.princeton.edu/mailman/listinfo/parsec-users
/>/ >
/>/ _______________________________________________
/




More information about the parsec-users mailing list