From 7ce892a9ffa14419f7eea1221389c48a2a47f53a Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 17 Sep 2024 12:59:30 +0200 Subject: [PATCH] Add example program for mark API --- doc/user/runtime/fig/mark.png | Bin 0 -> 6778 bytes doc/user/runtime/mark.md | 64 +++++++++++++++++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 doc/user/runtime/fig/mark.png diff --git a/doc/user/runtime/fig/mark.png b/doc/user/runtime/fig/mark.png new file mode 100644 index 0000000000000000000000000000000000000000..860da9bc2ba106414ef973e0fd3a835345ff4f1f GIT binary patch literal 6778 zcmb7pXIN8Rw{3iRrSlq!q97oI-U8C4hc2N=k=|P%bVOPZg-8>SB2oqE(m^_bpfqU# z1nEtB2k8*n*?i}_=eg%OKhC}TM|P5xz4lydjxooWI}zHNDiox2q#zK8LQPds2L$@d z5P1KQ_%Gl!+Rw@!I1zZk)bxmniKphZeuF@CkJS|A^?WC{XBoC}pxRTeSjvB3qsK~f>-OKy;dGGWe*{0ads(MEk{Qt-%yD(v;olXpbejAuXs10%zEAWYan>I?|Jd4cM@st2zEey(?O7Ac2MVJAuQ9k}47mR(cH6xDi~p!z zh*=H@Gzj)?VfkPS^C0LPlfGi{Sjg>T(%h@7tHU!h zQbwR@LgL8*TXW9bh`wWovFN=1kdv-25O-iGqO`0#CC#9SC zjEF=f_^m~4qPfcK?PpNU0d^0?ON%ThKp;6t_BgL@JQgt&lz2}Ka3bUk7^fIkq zYH#wCHQ3JKtI<$oS~|}IhGn3XPqk3iYhR;xOlH5jxH`|@o2RR>MnA(XB7V_DhmIkH zop1?aT8WNVFGq)8>S2kvy&v8cs4S?dJbVsY3-!utG-m+vu-|?+^U+4h^3G#|)w2Rb z?c5Di--s?!-_12!Wso@2_u5lY*NED1b zt;py^O{kP{m~SIRbaR-998D%6z{e1%r(8cu4e#jA01}}G&3MjzIK!Qs&#Wy39(Al3 z<@kD$t4(cy0%$7NdlN_dFG;m$uLPHl3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rn(cWnG@ng<3keiogl=|jUJ2NroGP+O0MCJ`m0*cw_7fbE@5A=0qg!_^N^{@!v`Z4 ziQakmj#wy{%g*@hQ0ubAOrJRHbgSNR(I7qH*rL+KPqs<@c62Dx%E8S^j2$1-=zIbX z2oYt<&kLGWdrB<0B`(79${e$Jpo~Xb6;$`yy%9Bmla# ztai;_Zf6vEj&V9jFa2nF$CM9ULxu*L{_%`|f|D*=6505wl2jXbW$dMf(fa3uqi|6x zG64I)vV$^*QC=;HF{v=pmC5`pgHMHcz9iqZ`FQhlBr?&tYx3MFW7Y2{q{2%1_*THv z%n1g_cCF +Example OmpSs-2 program +
+
+

+Here is a dummy program showing how to use the mark API with an OmpSs-2 program. +Notice that there is no initialization of the current thread or process, as it +already occurs inside the OmpSs-2 runtime before reaching the main. + +```c +/* Build with: + * $ clang -fompss-2 -lovni dummy.c -o dummy + * Enable instrumentation in nanos6: + * $ echo 'version.instrument = "ovni"' > nanos6.toml + * Run: + * $ ./dummy + * Emulate: + * $ ovniemu ovni + * View timeline: + * $ wxparaver ovni/cpu.prv ovni/cfg/cpu/ovni/mark.cfg + */ +#include +#include + +enum { INDEX = 0, RUN = 1 }; + +static void process(int run, int i) +{ + ovni_mark_push(RUN, run + 1); + ovni_mark_push(INDEX, i + 1); + usleep(10000); // Dummy operation for 10 ms + ovni_mark_pop(INDEX, i + 1); + ovni_mark_pop(RUN, run + 1); +} + +int main(void) +{ + ovni_mark_type(INDEX, OVNI_MARK_STACK, "Index"); + ovni_mark_type(RUN, OVNI_MARK_STACK, "Run"); + + for (int run = 0; run < 10; run++) { + for (int i = 0; i < 50; i++) { + #pragma oss task + process(run, i); + } + } + + #pragma oss taskwait + + return 0; +} +``` + + +

Here is the resulting timeline loaded in Paraver with the gradient color +configuration, showing the first mark type (the index): +

+ +
+ +

+ ## Usage in Paraver Each thread holds a channel for each mark type that you have defined. The