Concurrent computing: Difference between revisions

m
Removed output as specified by task, removed comments as language is clear enough.
m (Removed output as defined by task, removed version info as should be latest version.)
m (Removed output as specified by task, removed comments as language is clear enough.)
Line 50:
{{libheader|gomp}}
{{works with|OpenMP}}
<lang freebasic>PRAGMA OPTIONS -fopenmp
BaCon is a BASIC-to-C compiler. Assuming GCC compiler in this demonstration. Based on the C OpenMP source.
 
<lang freebasic>' Concurrent computing using the OpenMP extension in GCC. Requires BaCon 3.6 or higher.
 
' Specify compiler flag
PRAGMA OPTIONS -fopenmp
 
' Sepcify linker flag
PRAGMA LDFLAGS -lgomp
 
' Declare array with text
DECLARE str$[] = { "Enjoy", "Rosetta", "Code" }
 
' Indicate MP optimization for FOR loop
PRAGMA omp parallel for num_threads(3)
 
' The actual FOR loop
FOR i = 0 TO 2
PRINT str$[i]
NEXT</lang>
</lang>
 
{{out}}
<pre>prompt$ bacon concurrent-computing
Converting 'concurrent-computing.bac'... done, 11 lines were processed in 0.002 seconds.
Compiling 'concurrent-computing.bac'... cc -fopenmp -c concurrent-computing.bac.c
cc -o concurrent-computing concurrent-computing.bac.o -lbacon -lm -lgomp
Done, program 'concurrent-computing' ready.
prompt$ ./concurrent-computing
Code
Enjoy
Rosetta</pre>
 
=={{header|BBC BASIC}}==