# Execution failure

Here's an unlikely failure when a closure is executed after ArBB compilation.

It's a simple sparse-matrix dense-vector multiply, resulting in a dense vector. The sparse matrix has at least one non-zero entry in each row, which is generally true for realistic problems, so it can be thought of as a flattened nested container (i.e. dense vector)withcompanion dense vectors forsegment length and coefficient column index. This exampleincludes a dense vector for segment offset, as it helps illustrate the failure.

The closure function is...

# Matrix vector multiply

What would be the recommended ArBB code-outlineto efficientlymultiply a dense f.p.matrix by a dense f.p. vector?
e.g. M x V1 = V2
- paul

# segmentation fault in capture

the following compiles but runs with a seg fault. Anthing wrong?

===============================================
#include
#include

using arbb::i32;

bool condition = true;

// it is fine if data is passed by value only
// void hello(i32 data) {

void hello(i32& data) {
if (condition) {
std::cout << "hello, true!" << std::endl;
} else {
std::cout << "hello, false!" << std::endl;
}
}

int main() {
capture(hello);
return 0;
}

# Execution failures

This contrived code, boiled down from something that should work:

void my_call(dense &Out, const usize &Ncol)
{
#define NCOL 5 // OK
//#define NCOL 35000 // freezes (not inf. loop)
//#define NCOL 7*Ncol // Win7 says "process stopped working"

dense v = fill(2.f, NCOL, 3);
dense a(NCOL, 2);

a = replace_row(a, 0, sqrt(v.row(0)) + sqrt(v.row(1)));
a = replace(a, 0, NCOL, 1, 1, v);
Out = a.row(0);
}

# looping over mapped functions leads to "OUT_OF_MEM: ArBB Heap out of usage"

I have a standard c++ function that I wish to call repeatedly, with varying parameters, that in turn calls several arbb functions using arbb::call and arbb::map. It works for a while but eventually (after a couple of calls) leads to the
OUT_OF_MEM: ArBB Heap out of usage
error. Below is a greatly simplified version of the code that still gives me this error (using beta 1.4).

---
jason

============================================================================================

# include

# ArBB compiler error

Have boiled it down to this captured function:

void fubar(dense &Foo, const dense &Bar)
{
f32 test = 1.f;
f32 level = 0.001f;
_do {
... misc., or nothing!
}
_until (test < level);
Foo = Bar;
}

It doesn't get much simplier than that!

Good luck,
- paul

# COMP_ERROR: Dynamic Compiler Internal Error

When i try and run this code (this is a simplified version of the code but it generates the error) I get a
COMP_ERROR: Dynamic Compiler Internal Error. It occurs on the _if(v1[2]at least if I comment out this test and just do the calculation i don't get the error). What am I doing
that it doesn't like ?

void Fnc1a(f32 & result, dense v1,dense v2,dense A1, dense A2) {

u64 p = 1;
usize entry;
position(entry);
i32 offset = entry; // Need this due to casting problems . . .

# "O3" structure copy

Did you know that this...

void my_copy(T &Out, const T &In)
{
Out = In;
}
void my_call(dense &Out, const dense &In)
{
map(my_copy)(Out, In);
}

...runs faster with extra cores than this...

void my_call(dense &Out, const dense &In)
{
Out = In;
}

...which doesn't speed up at all, even though these do the same thing.

- paul

# why the following code cannot compile?

Just read through the guide. The following code is from the guide page 44.

The error message is

/usr/include/c++/4.2/complex:532: error: invalid initialization of non-const reference of type 'arbb_2::scalar&' from a temporary of type 'arbb_2::scalar'

Am I doing something wrong?

Thanks

======================================

#include
#include
#include

int main() {
std::complex z(1.0, 2.0);
z = z * z;

# Function suggestion

One can use e.g. section() to provide read-only "peephole" subsets of containers into map(), but there doesn't seem to be a read-write equivalent for map() results except to createa temporary container and then replace() the results.I've tried this and ArBBdoes not seem aware enough to eliminate the temporary data copies. The performance loss depends on the fractionof data being processed.

Also the othermap() inputsmust have the same dimensionality and size, which iskind of a waste.