Finally.. textures with metrics

Posted: 20th December 2011 by Luke Iwanski in C++, Honours Project, OpenGL, Voxel Engine

Textured 262144 cubes

This evening code hunger got me badly.. tomorrow, big launch of SW:TOR and lets be honest about it.. I will do no more honours project related work over this Christmas.

Anyway, in order to evaluate the software I have collected FPS and Memory Usage of the application.

Metrics for above project

Base metrics are like this:

Base Metrics

Funny enough, in texture integration progress I have made some optimisation, frame rate went up by slight cost of memory.. I am happy, I can deal with that.

Using OffloadCL to compile C++ AMP code for OpenCL

Posted: 6th December 2011 by Luke Iwanski in Offload
Tags: ,

C++ AMP (Accelerated Massive Parallelism) is a GPGPU API (STL-like library) implemented by Microsoft in c++11.

Lately, I had a pleasure to use an alternative tool-kit that is not limited to DirectX.
Technology that can be used on any device – that can run OpenCL – which not only reaches the performance offered by the C++ AMP but even goes beyond it – in some cases.

More information about the OffloadCL tool-kit – note that the OffloadCL tool-kit does not implement C++ AMP, it’s the flexible design allows the possibility to make it work C++ AMP code; see example below.

The showcase I want to present in this post is a Binomial Option Pricing Model (BOPM) – my objective was to “port” the code from this blog post so it will be using OffloadCL tool-kit.

More information about BOPM.

After few hours of setting up OffloadCL, few “why is that not working?” later I was ready to start my first application using OffloadCL tool-kit.. Well almost..

I had no idea what are the methods and approaches used in the tool-kit – there is no official documentation – yet – however there was a couple of ready examples and header file, for the rescue!

Few minutes later I was good to go.

When I started reading the C++ AMP source code, was pretty usual – small functions that do the job, few #define etc etc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//----------------------------------------------------------------------------
// Sequential(CPU) binomial option calculation
//----------------------------------------------------------------------------
void binomial_options_cpu()
{
  const unsigned data_size = MAX_OPTIONS;
   

    // this is like GPU kernel - where we have the meat
    for (unsigned i = 0; i < data_size; i++)
    {
        float call[NUM_STEPS + 1];

        // Compute values at expiration date:
        // call option value at period end is V(T) = S(T) - X
        // if S(T) is greater than X, or zero otherwise.
        // The computation is similar for put options.
        for(int j = 0; j <= NUM_STEPS; j++)
           call[j] = expiry_call_value(V_S[i], V_X[i], V_VDT[i], j);

        // Walk backwards up binomial tree
        for(int j = NUM_STEPS; j > 0; j--)
            for(int k = 0; k < = j - 1; k++)
                call[k] = V_PU_BY_DF[i] * call[k + 1] + V_PD_BY_DF[i] * call[k];

        CALL_VALUE_CPU[i] = call[0];
    }
}

Code from BinomialOptions.cpp

Code above is CPU version of binomial calculation, fairly simple.

However GPU version of this function is divided in two.

The method that prepares all buffers, in parallel_for_each function kernel method does all the calculations, for source code please download from here.

This is where things got complicated.. I had no big experience with parallel programming so I thought that I will need to spend a lot of time on research and learning, but apparently OffloadCL tool-kit made my work very easy..

What I had to do was to integrate the Offload compiler to the solution for the latest VS11 – there will be proper integration in the future.

Next step was to write some code in that file, small modification of the c++ code was enough to make the example work.

Get the source files for this post.

The OffloadCL tool-kit is still being improved, however I like the way how it works at the moment, the code is C like, simple and efficient.
I hope it will stay this way.

It was very easy and surprisingly straightforward to port C++ AMP code to OpenCL devices using OffloadCL compiler, looking forward to developing more using it!

Introduction to graphics programming submitted.

Posted: 28th November 2011 by Luke Iwanski in C++, OpenGL, University
Tags: , , , ,

some screen shots from assembly instruction project, n-Gine saved me again.. above result of the work from one night..

Graphics Programming wee update

Posted: 22nd November 2011 by Luke Iwanski in C++, OpenGL
Tags: , , ,

Pause screen + Animation

some progress of Graphics Programming coursework – pause screen and rotation. At the moment buffer of vertices is regenerated each frame – need to switch to DYNAMIC_DRAW.

Graphics Programming – small progress

Posted: 20th November 2011 by Luke Iwanski in C++, OpenGL, University
Tags: , , ,

Small progress: Skybox

Today I have managed to spend few minutes on Graphics Programming Coursework.. effect? SkyBox and clean code of n-Gine.

Next step.. animations.

Exhibition

Posted: 19th November 2011 by Luke Iwanski in C++, Kinect, OpenGL

Today I was helping in setting up system I was helping in developing n-Gine branch that supports Kinect.

How to store more than 35 Million floats?

Posted: 15th November 2011 by Luke Iwanski in Honours Project, University, Voxel Engine
Tags: ,

Grid 64x64x64

Task: need to store grid of 128x128x128 cubes (36 vertices each) no octree yet.. any ideas?

Step back.. re-think.

Posted: 13th October 2011 by Luke Iwanski in Honours Project, University, Voxel Engine
Tags:

Last few days disappeared from my life.

Thinking about “what exactly I want to evaluate in the engine” and “how do I compare it”, “with what”. Made me little bit crazier.

I came up with several ideas but yet.. not good enough.

Any ideas?

“What are the techniques of rendering voxel based objects in real time?”

This is a question I have been struggling with since last summer.

I will be doing that for next year – in my honours project.

I have designed test/experiments.
Some of them has been – already – eliminated.

However, there are so many things I could perform in order to make me my GPU cry.
meanwhile.. “boxel” engine is in development – time to test “crazy” ideas of mine.

First Test,

Many cubes…

Kinect + OpenGL + C++

Posted: 28th September 2011 by Luke Iwanski in C++, Kinect, OpenGL
Tags: , , ,

I have to say I am impressed by Kinects possibilities,

Camera, Depth recognition, Skeleton recognition even microphone!
I am just disappointed by lack of tutorials or even good documentation covering features that SDK offers.

Here is link to repository that contains little demo I have made.

Credits to kinectwinlib helped me a lot!