LINPACK on my Mac Pro (2008)

February 16th, 2011

Wed Feb 16 11:04:10 EST 2011
Intel(R) LINPACK data

Current date/time: Wed Feb 16 11:04:10 2011

CPU frequency: 3.192 GHz
Number of CPUs: 2
Number of cores: 8
Number of threads: 8

Parameters are set to:

Number of tests : 9
Number of equations to solve (problem size) : 15000 14000 13000 12000 11000 10000 8000 6000 1000
Leading dimension of array : 15000 14008 13000 12008 11000 10008 8008 6008 1000
Number of trials to run : 1 2 2 2 2 2 2 3 4
Data alignment value (in Kbytes) : 4 4 4 4 4 4 4 4 4

Maximum memory requested that can be used = 1800304096, at the size = 15000

============= Timing linear equation system solver =================

Size LDA Align. Time(s) GFlops Residual Residual(norm)
15000 15000 4 29.218 77.0215 2.229102e-10 3.510873e-02
14000 14008 4 23.261 78.6596 1.974021e-10 3.564871e-02
14000 14008 4 23.387 78.2380 1.974021e-10 3.564871e-02
13000 13000 4 18.865 77.6583 1.391097e-10 2.910766e-02
13000 13000 4 19.370 75.6335 1.391097e-10 2.910766e-02
12000 12008 4 14.931 77.1724 1.414329e-10 3.471450e-02
12000 12008 4 15.114 76.2383 1.414329e-10 3.471450e-02
11000 11000 4 12.206 72.7157 1.119935e-10 3.267318e-02
11000 11000 4 11.903 74.5649 1.119935e-10 3.267318e-02
10000 10008 4 9.333 71.4504 1.053194e-10 3.713669e-02
10000 10008 4 9.438 70.6607 1.053194e-10 3.713669e-02
8000 8008 4 4.885 69.8943 6.689474e-11 3.679791e-02
8000 8008 4 4.845 70.4809 6.689474e-11 3.679791e-02
6000 6008 4 2.351 61.2789 3.718256e-11 3.605912e-02
6000 6008 4 2.112 68.2045 3.718256e-11 3.605912e-02
6000 6008 4 2.156 66.8384 3.718256e-11 3.605912e-02
1000 1000 4 0.016 40.8875 1.290190e-12 4.399880e-02
1000 1000 4 0.016 41.9796 1.290190e-12 4.399880e-02
1000 1000 4 0.016 42.2710 1.290190e-12 4.399880e-02
1000 1000 4 0.016 42.1187 1.290190e-12 4.399880e-02

Performance Summary (GFlops)

Size LDA Align. Average Maximal
15000 15000 4 77.0215 77.0215
14000 14008 4 78.4488 78.6596
13000 13000 4 76.6459 77.6583
12000 12008 4 76.7053 77.1724
11000 11000 4 73.6403 74.5649
10000 10008 4 71.0555 71.4504
8000 8008 4 70.1876 70.4809
6000 6008 4 65.4406 68.2045
1000 1000 4 41.8142 42.2710

End of tests

Wed Feb 16 11:09:36 EST 2011

Testing totalMercury

June 10th, 2010

totalMercury is a test word to determine how long until it appears in google. it took 3 minutes after i published it, go go Caffeine.

Migration from PEAR MDB2 to PDO

April 15th, 2010

The FreeBSD ports tree switched from PHP 5.2.x to PHP 5.3.x earlier this month. As a result, I decided ensure compatibility with the new functionality in PHP 5.3. I used MDB2 as my database abstraction layer previously. A *lot* of code used this functionality. MDB2 hasn’t been updated in a while so I decided to switch to PDO. In order to maintain compatibility with the MDB2 interface I wrote this ‘incomplete’ wrapper for the functions I use. I thought I’d share in case someone else is running into a similar situation:

Updated 2011.10.31

< ?php
/*
Copyright 2011 Aldo Gonzalez. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.

THIS SOFTWARE IS PROVIDED BY Aldo Gonzalez ''AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <copyright HOLDER> OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the
authors and should not be interpreted as representing official policies, either expressed
or implied, of Aldo Gonzalez.

Extends PDO to ensure compatibility with some used functionality
from PEAR::MDB2
*/

class PDOStatementCommon {
private $pdoStatement;

public function __construct($obj)
{
$this->pdoStatement = $obj;
}

/* wrapper for MDB2 */
public function numRows()
{
return $this->pdoStatement->rowCount();
}

public function fetch($fetch_style = PDO::FETCH_ASSOC) {
return $this->pdoStatement->fetch($fetch_style);
}

/* wrapper for MDB2 */
public function fetchRow($fetch_style = PDO::FETCH_ASSOC) {
$row = $this->pdoStatement->fetch($fetch_style);
return $row;
}
}

class PDOCommon extends PDO {
private $limit = 0;
private $from = 0;

public function __construct($dsn, $username='', $password='',
$driver_options=array(), $isQuiet = false)
{
try {
parent::__construct($dsn, $username, $password, $driver_options);
} catch (Exception $e) {
error_log($e->getMessage());
if ($isQuiet) {
die();
} else {
die("Unable to connect to the database server. " .
"Please report the problem to an Administrator.");
}
}
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// only allow one statement per query
// should check that this attribute is only set on
// mysql databases
if($this->getAttribute(PDO::ATTR_DRIVER_NAME) == "mysql") {
$this->setAttribute(PDO::MYSQL_ATTR_DIRECT_QUERY, false);
}
}

public function query($str)
{
// check if limit has been specified. if so, modify the query
if (!empty($this->limit)) {
$limitRange = $this->limit;
if (!empty($this->from)) {
$limitRange = $this->from.", ".$limitRange;
}
$str .= " LIMIT ".$limitRange;

// after a query is executed the limits are reset, so that
// other queries may be performed with the same object
$this->limit = 0;
$this->from = 0;
}

try {
$obj_pdoStatement = parent::query($str);
} catch (Exception $e) {
error_log("[* SQL ERROR MESSAGE FOLLOWS:\n".
$e->getTraceAsString().
"\n".$e->getMessage().
"\nFull SQL Statement:".$str.
"\n*]");
die("An error occurred while executing the SQL statement. " .
"Please contact an Administrator and report the problem.
".
"<br /><hr />The following query generated an error:<br />".
"<pre>".
$this->formatSQLforHTML($str).
"\n\n".$e->getMessage().
"</pre>");
}

$obj_pdoStatementCommon = new PDOStatementCommon($obj_pdoStatement);

return $obj_pdoStatementCommon;
}

/* returns an HTML formatted SQL string */
protected function formatSQLforHTML($str)
{
$Keyword = array("SELECT ", "WHERE ", " ON ", "AND ", "OR ",
"FROM ", "LIMIT ", "UNION ",
"INNER ", "LEFT ", "RIGHT ", "JOIN ", ",",
"GROUP BY ", "ORDER BY ", "HAVING ");
foreach($Keyword as $key => $value) {
if ($value == ",") {
$Replace[$key] = "".$value."\n";
} else {
$Replace[$key] = "\n".$value."";
}
}

return str_replace($Keyword, $Replace, $str);
}

/* wrapper for MDB2 */
public function queryOne($str)
{
$result = $this->query($str);

$row = $result->fetch(PDO::FETCH_NUM);

return $row[0];
}

/* wrapper for MDB2 */
public function queryRow($str)
{
$obj_pdoStatement = parent::query($str);

$row = $obj_pdoStatement->fetch(PDO::FETCH_ASSOC);
return $row;
}

/* wrapper for MDB2 */
public function setLimit($limit, $from)
{
$this->limit = $limit;
$this->from = $from;
}

/* wrapper for MDB2 */
public function escape($str)
{
return $this->quote($str);
}
}
?>

FreeBSD 6.2 on a Dell Precision M90

June 7th, 2007

This started out as a FreeBSD 6.1 install but 6.2 is now out.
Notes for the installation of FreeBSD 6.2 on a Dell M90.

Configuration:
T2600 (Core Duo 2.16GHz)
Broadcom Gigabit network card
Dell Wireless 1490 802.11a/g Dual-band Mini-Card / Bluetooth
7200RPM 100GB SATA HD
17″ UXGA 1920×1200 screen

TODO:
soundcard – Sigmatel 9200 (not supported/working)
bluetooth
suspend on lid close
automount

Working:
patched wifi driver
NVIDIA TWINVIEW 1920×1200 x 2 displays + Beryl

ParaChat Conversation Parsing

April 13th, 2007

Parse tcpdump output of a ParaChat session in order to extract conversations.

#!/bin/sh
tcpdump -s 0 -A -r $1 | \
grep '#N"' | \
sed -e 's/\.*#N\$[\.[:space:]]*/|(/g' \
-e 's/#N"[\.]*/V:V/g' \
-e 's/#N&.*//g' \
-e 's/.*|(//g' \
-e 's/PC\.*#N.*//g' \
-e 's/V:V/ : /g' \
| grep -v '[HI@L].*PC\.\..*+.*'

Canon Warranty

April 5th, 2007

I recently purchased a Canon 85mm 1.2/F L Lens and I loved the pictures it captured. While using it in a shoot for one of my macro shots, I noticed a flaw (tiny, but a flaw nonetheless) in one of the interior lenses. That meant repair time! I've had no problems with Canon products in the past. I judge many companies by their Service Departments so I was hoping Canon wouldn't let me down. I went to their website, found the number, called, obtained the appropriate information, shipped my lens to NJ for repair via UPS (I'm starting to like them too). I received an email from Canon letting me know my lens was going to be serviced and I would have it within 7 days. Three days later, I received an email letting me know my lens had been shipped back. Thats what I call efficiency. Kudos to Canon. Hopefully I won't need to deal with that part of their business in the future but its nice to know if I do, it will be pleasant.

Commute

March 27th, 2007

The early bird also catches a closed highway, copious traffic, and the slowest train known to mankind. The lesson: hurried patience.

Into the rythm

March 8th, 2007

Leaves swirl a dance,
wind clears the blue road,
clenching to a moment of strength,
eyes open to the dark plates of love.
Family surrounds the core of creation.
A smile forms and a laugh breathes. Was, is, will be… Now!

UTC!

March 7th, 2007

We don’t live in the dark ages people (that would be circa 1910. Lets pick a standard and live with it. Ok, there is a standard, its UTC. I’m setting my watch to UTC starting today.

MySQL 5.0.33 dropped database connection

February 26th, 2007

UPDATE: Problem resolved in MySQL 5.0.37

Update: Bug report created:

http://bugs.mysql.com/26646

I recently upgraded our production servers to MySQL 5.0.33 after using it in development for a while. I started receiving the following errors:

Lost connection to MySQL server during query

and

MySQL server has gone away

I traced the problem to one query that when performed in the mysql client was causing:

ERROR 2006 (HY000): MySQL server has gone away

No connection. Trying to reconnect…

after each execution:

Below is a sample database and query that will reproduce the bug:

DROP DATABASE IF EXISTS Bug;

CREATE DATABASE Bug;

USE Bug;

CREATE TABLE `A` (

`aID` int(10) unsigned NOT NULL auto_increment,

`aData` varchar(15) NOT NULL default ”,

`aPhase` tinyint(3) NOT NULL default ’0′,

PRIMARY KEY (`aID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `B` (

`bID` int(10) unsigned NOT NULL auto_increment,

`baID` int(10) unsigned NOT NULL default ’0′,

PRIMARY KEY (`bID`),

KEY `baID` (`baID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `A` VALUES (306863,’01133935022′,-10),(306864,”,-10);

INSERT INTO `B` VALUES (1532595,306863),(1532597,306864);
/* Run this multiple times to drop connections to server */

SELECT

(SELECT SUM(aID) FROM B WHERE baID = aID),

COUNT(DISTINCT(bID))

FROM A c

LEFT JOIN B ON aID = baID

WHERE

aPhase = -10

AND

(SELECT COUNT(*) FROM A dup

WHERE dup.aPhase = -10

AND c.aData = dup.aData) > 0

GROUP BY aID

ORDER BY aData, aID;