I realixe, per section 13.2,
Each thread has a "mailbox" which is used for inter-thread
communication.
however, is there a builtin for global mailboxes (mailboxes taht are
just variables; rather than mailboxes associated with threads)?
Thanks
Hi!
I have some pre-existing library code I'm dealing with, which I can
pass it an port (that the library will send output to).
Is it possible to create a function foo, so that
(foo output-port1 output-port2)
will return me a output-port-magic
s.t. when anything iw written to output-port-magic, it's written to
both output-port1 and output-port2?
Thanks!
Hi,
I have found the following remark by Marc in one of the posts,
On some platforms (processor and operating system dependent) that can
execute dynamically generated machine code (32 bit intel, power-pc,
sparc), you can pass any procedure including closures. This feature
is enabled if USE_dynamic_code_gen is defined in lib/os_dyn.h and this
is the default in recent versions of Gambit. Give it a try... it may
work to pass a closure on your platform... but don't count on it to be
portable!
Could somebody explain how it works?
michele
Marc:
At this point, gcc 4.5.0 promises to be able to compile most
Gambit-generated C files at high optimization levels in a "reasonable"
amount of CPU time and memory. So I configured Gambit with
./configure CC='/pkgs/gcc-mainline/bin/gcc -march=core2 -msse4 -O3 -fschedule-insns' --enable-multiple-versions --enable-single-host"
and then I removed by hand the "-O1" compilation options inserted into
the makefiles by the configure script. The version of gcc I used was
heine:~/programs/gambc-v4_5_2-devel> /pkgs/gcc-mainline/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/pkgs/gcc-mainline/bin/gcc
COLLECT_LTO_WRAPPER=/pkgs/gcc-mainline/libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../../mainline/configure --enable-checking=release --prefix=/pkgs/gcc-mainline --enable-languages=c --disable-multilib
Thread model: posix
gcc version 4.5.0 20091005 (experimental) [trunk revision 152459] (GCC)
With my quickie benchmark program:
gsi/gsi -e '(define a (time (expt 3 10000000)))(define b (time (* a a)))'
the routine (direct-fft-recursive-4 a table) computed the final direct
(forward) FFT with 2097152 complex elements in 156 ms. This means that
we were getting
> (/ (* 5 2097152 21) .156)
1411544615.3846154
FLOPS (because it takes $5 N \log_2 N$ floating-point operations for an
FFT of size N). So that's 1411 MFLOPS with a 2.33 GHz Core 2 Duo; FFTW
reports about 2200 MFLOPS on a 3.0 GHz Xeon Core Duo using the Intel
compiler icc here:
http://www.fftw.org/speed/CoreDuo-3.0GHz-icc64/
The Xeon has a faster memory bus and is generally faster than the Core 2
Duo clock-per-clock; but just the ratio of CPU speeds would give a rate
of
> (* 1411 (/ 3.0 2.33))
1816.7381974248929
predicted MFLOPS for Gambit.
I'm not going to get into a slanging match about gcc versus icc, but
overall this looks pretty damn good.
Brad
Hi,
I have the following two functions for converting a pointer to some
struct Foo into the "value" struct Foo:
(define value-Foo-1
(c-lambda ((pointer (struct "Foo"))) (struct "Foo")
#<<c-lambda-end
void* mem = malloc(sizeof(Foo));
new (mem) Foo(*___arg1);
___result_voidstar = mem;
c-lambda-end
))
(define value-Foo-2
(c-lambda ((pointer (struct "Foo"))) (struct "Foo")
"___result = *___arg1;"))
(value-Foo-1) works and (value-Foo-2) crashes. Is this expected?
If so, is there a more elegant way to express the code of value-Foo-1?
Also: is it OK to use malloc here or am I supposed to use ___alloc_rc
or ___C_ASSIGN_NEW ?
Do I have to worry about providing code for releasing the memory allocated?
Finally, I am curious whether there is any difference internally
between the handling of (struct "Foo") and (type "Foo"), or is this
just naming for the sake of clarity?
Hi Brad!
Where can I get my hands on a meroon system integrated with recent gambit
builds? I couldn't find it on your homepage and neither on the meroon official
webpage which seems to point to a bad url.
Thanks!
David
Marc:
I tried to upload
MeroonV3-2008Mar01.tar.bz2
and got the message
Upload warning
".bz2" is an unwanted file type
List of allowed file types: png, gif, jpg, jpeg, scm,
tgz, zip, pdf, odf, doc, html
That's a little old fashioned, isn't it?
Brad
http://www.iro.umontreal.ca/~gambit/doc/gambit-c.html#mapping-of-types says:
> In the case of the struct, union and type types, the internal pointer
> points to a copy of the C data type being represented. When an
> instance of one of these types is converted from C to Scheme, a block
> of memory is allocated from the C heap and initialized with the
> instance and then a foreign object is allocated from the Scheme heap
> and initialized with the pointer to this copy. [...]
Does this mean that existing foreign objects are immutable?
Hi there,
cross-posting this because it's relevant to both parties: this is to
let you know that I've started implementing a Gambit [1] back-end for
SWIG.
So far I have the simple example from the beginning of the tutorial
working [2]. Of course that's only the tip of the iceberg but, getting
there...
You, both Gambit and SWIG people, will likely hear from me soon with
some specific questions.
In the meantime, if you have any thoughts, suggestions, or relevant
pointers -- they are welcome.
[1] http://dynamo.iro.umontreal.ca/~gambit/wiki/index.php/Main_Page
[2] http://www.swig.org/tutorial.html