From 69f2911e04ffb1b19eef1fafb8c040af271f656e Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Thu, 15 Jul 2010 18:09:46 -0800 Subject: creating branch for adding support for CUDA 3.x and Fermi [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6829] --- .../CUDA/CP/common/python/binaryfilecompare.py | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 benchmarks/CUDA/CP/common/python/binaryfilecompare.py (limited to 'benchmarks/CUDA/CP/common/python/binaryfilecompare.py') diff --git a/benchmarks/CUDA/CP/common/python/binaryfilecompare.py b/benchmarks/CUDA/CP/common/python/binaryfilecompare.py new file mode 100644 index 0000000..b143b68 --- /dev/null +++ b/benchmarks/CUDA/CP/common/python/binaryfilecompare.py @@ -0,0 +1,50 @@ +# (c) Copyright 2007 The Board of Trustees of the University of Illinois. + +import struct + +def uint16(f): + """Read a 16-bit unsigned integer from f.""" + [c, c2] = f.read(2) + return ord(c) + (ord(c2) << 8) + +def uint32(f): + """Read a 32-bit unsigned integer from f.""" + [c, c2, c3, c4] = f.read(4) + return ord(c) + (ord(c2) << 8) + (ord(c3) << 16) + (ord(c4) << 24) + +def float(f): + """Read a floating-point number from f.""" + s = f.read(4) + (n,) = struct.unpack("