QUARK  0.9.0
QUARK-QUeuingAndRuntimeforKernels
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
hello_world.c File Reference
#include <string.h>
#include <stdlib.h>
#include "quark.h"
Include dependency graph for hello_world.c:

Go to the source code of this file.

Functions/Subroutines

void hello_world_task (Quark *quark)
void test1 (Quark *quark)
void test2 (Quark *quark)
 main ()

Function/Subroutine Documentation

void hello_world_task ( Quark quark)

Definition at line 8 of file hello_world.c.

References QUARK_Thread_Rank(), and quark_unpack_args_2.

{
int idx; char *str;
quark_unpack_args_2( quark, idx, str );
printf( "%c - from the thread rank %d\n", str[idx], QUARK_Thread_Rank(quark) );
str[idx] = 'x';
}

Here is the call graph for this function:

Here is the caller graph for this function:

main ( )

Definition at line 49 of file hello_world.c.

References QUARK_Delete(), QUARK_New(), test1(), and test2().

{
Quark *quark = QUARK_New( 3 );
printf( "QUARK is going to use 3 threads.\n\n" );
test1( quark );
test2( quark );
QUARK_Delete( quark );
}

Here is the call graph for this function:

void test1 ( Quark quark)

Definition at line 16 of file hello_world.c.

References hello_world_task(), INPUT, QUARK_Barrier(), QUARK_Insert_Task(), and VALUE.

{
int idx;
char str[] = "Hello World";
printf( "Initial contents of string: %s\n", str );
printf( "Each QUARK task will print off a character from string, and replace it with an x.\n" );
printf( "The dependencies are all INPUT, so all the tasks can run in parallel.\n" );
for ( idx=0; idx<strlen(str); idx++ ) {
sizeof(int), &idx, VALUE,
strlen(str)*sizeof(char), str, INPUT,
0 );
}
QUARK_Barrier( quark );
printf( "Final contents of string: %s\n\n", str );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void test2 ( Quark quark)

Definition at line 32 of file hello_world.c.

References hello_world_task(), INOUT, QUARK_Barrier(), QUARK_Insert_Task(), and VALUE.

{
int idx;
char str[] = "Hello World";
printf( "Initial contents of string: %s\n", str );
printf( "Each QUARK task will print off a character from string, and replace it with an x.\n" );
printf( "The dependencies are all INOUT, so all the tasks are serialized.\n" );
printf( "Because of locality and serialization, the tasks will all run on one thread.\n" );
for ( idx=0; idx<strlen(str); idx++ ) {
sizeof(int), &idx, VALUE,
strlen(str)*sizeof(char), str, INOUT,
0 );
}
QUARK_Barrier( quark );
printf( "Final contents of string: %s\n\n", str );
}

Here is the call graph for this function:

Here is the caller graph for this function: