cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

kos
Journeyman III

Problem with getting brook+ program result

I've sum test project working but i can't save result's to file, and program window disappears to quickly no matter what I'm trying to do: read from console or make infinity loop.

0 Likes
12 Replies
Ceq
Journeyman III

Visual Studio will pause the program window after execution, however looks like your program isn't finishing normally, but with some kind of error.
If you just want a easy way to pause your program you can use this line in your code:

system("pause");

The program will stop execution until you press any key.
If you use it after the program error it won't work (in the same way read from console or the inf loop fails), so you have to try several locations.
Making a debug compilation and using the built in debugger is a better solution, you can insert breakpoints in your code and see step by step the excecution and variable data.
Check your code because it could be you're using 'streamWrite' not reserving enough memory with malloc for the destination variable.
0 Likes
kos
Journeyman III

I've used getch(), and saw that simple_matmult program writes two input matrix and nothing else,  now I see that problem is here

::brook::stream A(::brook::getStreamType(( float *)0), Height , Width,-1); 

0 Likes
dukeleto
Adept I

edit: I hadn't seen the previous answer!
0 Likes
Ceq
Journeyman III

I think that is a stream allocation failure... probably related to CAL
What GPU are you using?

You can also try running it with the CPU backend, setting the environment variable BRT_RUNTIME=CPU
0 Likes
kos
Journeyman III

 

 I'm using Palit 2600XT sonic. Take a look at this code:

::brook::stream A(::brook::getStreamType(( float *)0), Height , Width,-1);
::brook::stream B(::brook::getStreamType(( float *)0), Width , Height,-1);
::brook::stream C(::brook::getStreamType(( float *)0), Height , Height,-1);
Start(0);
getch();//1
streamRead(A, inputA);
getch();//2
streamRead(B, inputB);
for (i = 0; i < sizeof(inputA); ++i)
{
simple_matmult((float ) (Width), A, B, C);
}
The programs spops twice and there are now

"Unhandled exception at 0x00409ba1 in simple_matmult.exe: 0xC0000005: Access violation reading location 0x00000000."

I'm using CPU backend, may be problem is in "sizeof(inputA)" statement. I've changed original code to that becouse I've no console input

0 Likes
Ceq
Journeyman III

Umh, I think "Access violation reading location 0x00000000" is a null pointer exception.
Does the second streamRead returns?
Does it perform at least one iteration?



1. It will be easier if you start a debug session:

In the '.cpp' file you can set breakpoints by clicking in the gray vertical bar at the beginning of each line. (If you set them in the '.br' file it won't stop)

Debug -> Start debugging

Now the program will halt at the specified lines, for example, you can:
- Advance one instruction with 'Step Over' button
- Continue the execution with the play button
- Monitor variable values looking for any null pointer



2. You don't need console input to set the number of iterations in the examples, it
is only a program parameter:

Project -> Properties -> Configuration properties -> Debugging -> Command Arguments -> -i (iterations)

In 'common.h' you can see a list of parameters you can use.



3. Note:
It isn't a error, but I think 'sizeof(inputA)' is a bit weird as iteration control,
if inputA is a pointer it will return 4 (8 in 64 bit mode), and if inputA is a array it will return the size in bytes, for example, with float 'inputA[10];' it will return 40



I hope you find it helpfull, I apologize if you already knew this.
0 Likes
kos
Journeyman III

first StreamRead was successfull.

There are no cmd.iterations parameter. And i can enable gpu computations at all, after first getch() i see "Using cpu backend" massage. I can't use debug in VS2008. The following code :

for (i = 0; i < 1; ++i)
{

    simple_matmult((float ) (Width), A, B, C);

}
returns the same exeption

I think that StreamRead's at all works right.

0 Likes
Ceq
Journeyman III

Sorry, I'm a bit confused...
Isn't there a cmd.Iterations parameter? I thought you were running simple_matmult example, have you modified it?
Do other Brook+ examples work?
Why can't you use debug in VS2008? I've tested and it seems to work ok.
What happens if you disable line "simple_matmult((float..." , still unhandled exception message?
0 Likes
kos
Journeyman III

following code

::brook::stream A(::brook::getStreamType(( float *)0), Height , Width,-1);
::brook::stream B(::brook::getStreamType(( float *)0), Width , Height,-1);
::brook::stream C(::brook::getStreamType(( float *)0), Height , Height,-1);
Start(0);
streamRead(A, inputA);
streamRead(B, inputB);
getch();//1
for (i = 0; i < 1; ++i)
{
//simple_matmult((float ) (Width), A, B, C);
}
getch();//2
streamWrite(C, output);
getch();//3
Stop(0);
getch();//4

couses following result

0,001327 foreach item in stream C

I can't use debug becouse there are some problems with  using cusom tool in VS2008. I can't run brok+ in debug at all.

0 Likes
Ceq
Journeyman III

I see, it was the kernel call as I suspected, I think there is something wrong with your Brook / CAL installation.
Sorry, all I can advice is to reinstall it, better if you use a WinXP / VS2005 environment.
I've been using both VS2005 & VS2008 for some time, but I can't understand what's the wrong with your VS2008, however it looks like a configuration problem because debug should work.
Maybe other people in the forum could have another suggestion...
0 Likes

VS2008 is only "Preliminarily" supported, what that means I have no idea. Sounds like it's still not supported to me.
0 Likes

Hi ryta1203,

We just added VS2008 support in v1.1-beta. However, it has not seen as much use as VS2005.

Hi kos,

Are you using v1.1-beta?

Michael.
0 Likes