source: soft/giet_vm/applications/ocean/null_macros/c.m4.null.GIET @ 714

Last change on this file since 714 was 693, checked in by guerin, 9 years ago

remove last references to giet_shr_printf()

File size: 2.3 KB
Line 
1divert(-1)
2define(NEWPROC,) dnl
3
4define(BARRIER, `{
5    unsigned int wait_start, wait_end;
6    unsigned int id = giet_thread_id();
7   
8    CLOCK(wait_start)
9    sqt_barrier_wait(&($1));
10    CLOCK(wait_end)
11    *gp[id].sync_time += wait_end - wait_start;
12   
13}')
14
15define(BARDEC, `
16giet_sqt_barrier_t ($1);
17')
18
19define(BARINIT, `{
20    giet_assert (nclusters_x * nclusters_y * procs_per_cluster == (unsigned int)$2, "Incorrect mesh for sqt_barrier\n");
21   
22    while (heap_inited != $2) {
23        asm volatile("nop\r\n");
24    }
25    giet_tty_printf("Tas initialisés\n");
26        sqt_barrier_init(&($1), nclusters_x, nclusters_y, procs_per_cluster);
27}')
28
29define(LOCKDEC, `sqt_lock_t ($1);')
30define(LOCKINIT, `{
31    sqt_lock_init(&($1), nclusters_x, nclusters_y, procs_per_cluster);
32}')
33define(LOCK, `{
34    unsigned int wait_start, wait_end;
35    unsigned int id = giet_thread_id();
36    CLOCK(wait_start)
37    sqt_lock_acquire(&($1));
38    CLOCK(wait_end)
39    *gp[id].sync_time += wait_end - wait_start;
40}')
41define(UNLOCK, `{sqt_lock_release(&($1));}')
42
43define(WAIT_FOR_END, `{
44        giet_tty_printf("Wait threads...\n");
45        BARRIER(bars->barrier)
46}')
47
48define(CREATE, `{
49    long id_main = 0;
50        run_threads = 1;
51   $1(&id_main);
52}')
53
54define(MAIN_INITENV, `{
55    giet_procs_number(&nclusters_x, &nclusters_y, &procs_per_cluster);
56        heap_init(0, 0);
57        heap_inited += procs_per_cluster;
58}')
59define(MAIN_END, `{exit(0); return 0;}')
60
61define(MAIN_ENV,`
62#include <user_sqt_lock.h>
63#include <user_barrier.h>
64#include <stdio.h>
65#include <stdlib.h>
66#include <malloc.h>
67#include "giet_utils.h"
68
69#define MAX_THREADS 512
70/*#include <pthread.h>
71#include <sys/time.h>
72#include <sys/fcntl.h>
73#include <sys/resource.h>
74#include <unistd.h>
75#include <stdlib.h>
76pthread_t PThreadTable[MAX_THREADS];
77*/
78')
79
80define(ENV, ` ')
81define(EXTERN_ENV, `
82
83#include <user_sqt_lock.h>
84#include <user_barrier.h>
85#include <stdio.h>
86#include <malloc.h>
87
88#include "giet_utils.h"
89
90/*#include <pthread.h>
91#include <sys/time.h>
92#include <sys/stat.h>
93#include <sys/resource.h>
94#include <unistd.h>
95#include <stdlib.h>
96#include <stdio.h>
97extern pthread_t PThreadTable[];*/
98')
99
100define(G_MALLOC, `ocean_malloc($1, $2);')
101
102define(CLOCK, `{
103   ($1) = giet_proctime();
104}')
105
106define(START_PHASE, `{
107    CLOCK(*gp[$1].step_start)
108}')
109define(END_PHASE, `{
110    unsigned int t;
111    CLOCK(t)
112    gp[$1].steps_time[($2)-1] += (double)t - *gp[$1].step_start;
113}')
114
115divert(0)
Note: See TracBrowser for help on using the repository browser.