| Andrew Cooke | Contents | Latest | RSS | Twitter | Previous | Next


Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

Personal Projects

Lepl parser for Python.

Colorless Green.

Photography around Santiago.

SVG experiment.

Professional Portfolio

Calibration of seismometers.

Data access via web services.

Cache rewrite.

Extending OpenSSH.

C-ORM: docs, API.

Last 100 entries

Maybe run a command; Sterile Neutrinos; Strawberry and Banana Jam; The Best Of All Possible Worlds; Kenzaburo Oe: The Changeling; Peach Jam; Taste Test; Strawberry and Raspberry Jam; flac to mp3 on OpenSuse 42.1; Also, Sebald; Kenzaburo Oe Interview; Otake (Kitani Minoru) move Black 121; Is free speech in British universities under threat?; I am actually good at computers; Was This Mansplaining?; WebFaction / LetsEncrypt / General Disappointment; Sensible Philosophy of Science; George Ellis; Misplaced Intuition and Online Communities; More Reading About Japan; Visibilty / Public Comments / Domestic Violence; Ferias de Santiago; More (Clearly Deliberate); Deleted Obit Post; And then a 50 yo male posts this...; We Have Both Kinds Of Contributors; Free Springer Books; Books on Religion; Books on Linguistics; Palestinan Electronica; Books In Anthropology; Taylor Expansions of Spacetime; Info on Juniper; Efficient Stream Processing; The Moral Character of Crypto; Hearing Aid Info; Small Success With Go!; Re: Quick message - This link is broken; Adding Reverb To The Echo Chamber; Sox Audio Tools; Would This Have Been OK?; Honesty only important economically before institutions develop; Stegangraphy via PS4; OpenCL Mess; More Book Recommendations; Good Explanation of Difference Between Majority + Minority; Musical Chairs - Who's The Privileged White Guy; I can see straight men watching this conversation and laffing; Meta Thread Defending POC Causes POC To Close Account; Indigenous People Of Chile; Curry Recipe; Interesting Link On Marginality; A Nuclear Launch Ordered, 1962; More Book Recs (Better Person); It's Nuanced, And I Tried, So Back Off; Marx; The Negative Of Positive; Jenny Holzer Rocks; Huge Article on Cultural Evolution and More; "Ignoring language theory"; Negative Finger Counting; Week 12; Communication Via Telecomm Bids; Finding Suspects Via Relatives' DNA From Non-Crime Databases; Statistics and Information Theory; Ice OK in USA; On The Other Hand; (Current Understanding Of) Chilean Taxes / Contributions; M John Harrison; Playing Games on a Cloud GPU; China Gamifies Real Life; Can't Help Thinking It's Thoughtcrime; Mefi Quotes; Spray Painting Bike Frame; Weeks 10 + 11; Change: No Longer Possible To Merge Metadata; Books on Old Age; Health Tree Maps; MRA - Men's Rights Activists; Writing Good C++14; Risk Assessment - Fukushima; The Future of Advertising and Surveillance; Travelling With Betaferon; I think I know what I dislike so much about Metafilter; Weeks 8 + 9; More; Pastamore - Bad Italian in Vitacura; History Books; Iraq + The (UK) Governing Elite; Answering Some Hard Questions; Pinochet: The Dictator's Shadow; An Outsider's Guide To Julia Packages; Nobody gives a shit; Lepton Decay Irregularity; An Easier Way; Julia's BinDeps (aka How To Install Cairo); Good Example Of Good Police Work (And Anonymity Being Hard); Best Santiago Burgers; Also; Michael Emmerich (Vibrator Translator) Interview (Japanese Books); Clarice Lispector (Brazillian Writer)

© 2006-2015 Andrew Cooke (site) / post authors (content).

Some Initial Results for Overlapping Tiles with CUDA

From: "andrew cooke" <andrew@...>

Date: Mon, 28 Jul 2008 20:36:24 -0400 (CLT)

I wrote the following code to simulate (perhaps not exactly) the memory
loads that would occur using CUDA if the data were processed using a
tiling that overlaps (so something like the Matrix example, but with
leaking across the boundaries of the box - perhaps for convolving with a
kernel, for example, or, as in my case, calculating "life").

Using the approach shown in the code (large integer types and a single
overlap) is inefficient because (at least for CUDA 1.0 ad 1.1) the reads
cannot be coalesced - either the half weft is the wrong width, or the
shift (which is less than the half-weft to allow for overlapping) is

I'm going to see now if using a smaller integer type and overlapping a
whole half-weft makes more sense (sounds crazy, but might work...).


(these is just the core block to give some idea of what's happening)

// run through each tile position
int count = 0;
for (int j = 0; j < nY; j++) {
    for (int i = 0; i < nX; i++) {
        // for each tile, run through the half-warps
        for (int k = 0; k < nHalfWarps; k++) {
            for (int l = 0; l < halfWarp; l++) {
                int localOffset = k * halfWarpWidth + l * word;
                int localX = localOffset % windowX;
                int localY = localOffset / windowX;
                int globalX = i * strideX + localX;
                int globalY = j * strideY + localY;
                int globalOffset = globalY * (*paddedX) + globalX;
                int segStart = globalOffset / segment;
                int segEnd =                                        \
                    (globalOffset + halfWarpWidth - word) / segment;

                if (prop.minor < 2) {
                    // 1.0 and 1.1 are really strict about what will
                    // be coalesced.
                    if (segStart == segEnd) {
                        count = count + 1;
                    } else {
                        count = count + halfWarp;
                } else {
                    // 1.2 is more lenient and simply groups as
                    // necessary
                    count = count + segEnd - segStart + 1;

And the output:

Loads for 1234,1234 using  184,  20 stepping  176,  19
8 bytes/word; 128 segments; 16 half-warp
Best count 3180010 for 184, 20 over 1240,1236

See how the stepping here is 8 bytes in 8 because I used 8 byte ints (even
though I only need 1 bit overlap)

The total number of theeads per block would be 184*20/8 = 460.

Better Code + Numbers

From: "andrew cooke" <andrew@...>

Date: Mon, 28 Jul 2008 21:45:23 -0400 (CLT)

There were a fair number of bugs in teh code above.  Not sure I have it
right yet, but I seem to be getting numbers that make more sense.

So, the possible tactics are:

1 - Use a large integer and overlap only as little as possible.
2 - Use a small integer and overlap by a whole segment
3 - Use a large integer and overlap by a whole segment

For a "very large" (ie each dimension significantly larger than the
largest possible tile dimension) data area, searching only over the
largest tiles (ie given X, calculate Y from memory limitations etc) the
relative numbers of memory loads (smaller the better) are:

1 - 10
2 - 2
3 - 1

So it's clearly better to overlap by a whole segment, even though more
memory is "thrown away" (as expected).  The relative speeds for the two
integer sizes just reflects the sizes themselves (4 v 8 bytes).  Since
larger integers load more slowly this may not be significant.

For the original size I was using (1234 x 1234 bytes) things are less
clear because the size of the tile approaches the size of the data in some
configurations, so tweaking tiles shapes becomes significant (in fact [1]
won out because a tile could cover all the data, but [3] was still close).


Comment on this post