binary file within a shell script
Hi there, I would like to use one exec file from a shellscript but I would like it to be incorporated in the same file, like Nvidia do for its FreeBSD drivers. How can I do this in a convenient way ? Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: python modules
2007/7/13, Mike Meyer <[EMAIL PROTECTED]>: On Fri, 13 Jul 2007 21:12:33 +0200 "Mathieu Prevot" <[EMAIL PROTECTED]> wrote: This apparently got redirected without sufficient context, so I'm guessing. I forgot to cc to hackers. > 2007/7/13, Mathieu Prevot <[EMAIL PROTECTED]>: > > I learn that modules loaded with import fall into 4 general categories: > > - code written in Python (.py) > > - C or C++ extensions that have been compiled into shared libraries (or DLLs) These are *Python extensions* written in C or C++ (among other things), not arbitrary shared object libraries (or .so's). > > - Packages containing collection of modules > > - Built-in modles writen in C and linked into the Python interpreter > > Why don't we use directly the libpmc library in C instead of rewritting > > things in python ? Are you writing in Python now and want to use libpmc? Doing that is one approach. I'm doing this. This approach _seems_ to be the easier way. > I copied libpmc.so and tryed 'import libpmc'. I have: > ImportError: dynamic module does not define init function (initlibpmc) To be expected. The init function is part of what turns it into a Python extension library. > Are we really far from having a libpmc module ? There are at least two other approaches to getting access to libpmc from Python: 1) Write a wrapper library that is a Python extensions and translates calls. This work is in progress in fact, but I wanted to have ASAP access to pmc(3) with a minimum of (keyboard) effort. I don't care of docstrings. 2) Use the ctypes python module to access libpmc. ctypes has been bundled into 2.5, so that would be my preference. Just one less thing to install. This is probably more appropriate in c.l.python, but it's hard to say without context. I didn't tryed this module, rather (a bit) the ezpyinline module, coupled to `gcc -E /usr/src/lib/libpmc/libpmc.c` (no preprocessing with the module, only compilation). The ezpyinline module work like this: #!/usr/bin/python import ezpyinline #step 1 code = r""" int helloworld() { printf("hello ezpyinline! "); } """ #step 2 ezc = ezpyinline.C(code) #step 3 ezc.helloworld() I'll give ctypes a chance (when I have time :) )... thanks Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: python modules
2007/7/13, Mathieu Prevot <[EMAIL PROTECTED]>: I learn that modules loaded with import fall into 4 general categories: - code written in Python (.py) - C or C++ extensions that have been compiled into shared libraries (or DLLs) - Packages containing collection of modules - Built-in modles writen in C and linked into the Python interpreter Why don't we use directly the libpmc library in C instead of rewritting things in python ? I copied libpmc.so and tryed 'import libpmc'. I have: ImportError: dynamic module does not define init function (initlibpmc) Are we really far from having a libpmc module ? Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
get active processes in python
Hello, do you recommend a method to get active processes in a python script, as with "ps" or "top" in order to put the result into a list ? (python package, shell call...) Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: get active processes in python
2007/7/12, Mathieu Prevot <[EMAIL PROTECTED]>: Hello, do you recommend a method to get active processes in a python script, as with "ps" or "top" in order to put the result into a list ? (python package, shell call...) Mathieu PS: I would like to fire this regularly, eg every second ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
SoC / PMC
2007/5/25, Joseph Koshy <[EMAIL PROTECTED]>: Do you intend to run FreeBSD under Parallels? If so you may need to check if Parallels emulates PMC hardware correctly. The other emulators do not. You may need a regular i386 or amd64 PC to run FreeBSD on 'bare metal'. I compiled a SMP (seems not to detect 2 CPUs) kernel on a black macbook (Intel Core 2 Duo) under parallels (Build 3188), with 'options HWPMC_HOOKS'. After reboot, I `kldload hwpmc` and obtain: pmc: Unknown Intel CPU. module_register_init: MOD_LOAD (hwpmc, 0xc05b0114, 0xc3662094) error 78 It seems, the module can't achieve initalization.. please help ! Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
automatic KSE for multithreaded programs
Hello, the KSE system is complicated. Are there projects or possibilities to split automatically threads into groups given a SMP system in a clever manner ? Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
sysctl(3) and sysctl(8) discrepancies
Hello, I have FreeBSD 6.1-RC #27: Wed Apr 19 02:08:00 CEST 2006 amd64 and I have 3 different outputs about hw.ncpu: `sysctl hw.ncpu` gives me: 'hw.ncpu: 2' and I have: hw.ncpu = 6 hw.ncpu = 3 with: #include #include #include main() { int ncpu[1]; size_t len; len=sizeof(int); sysctlnametomib("hw.ncpu",ncpu,&len); printf("hw.ncpu = %d\n",(*ncpu)); printf("hw.ncpu = %d\n",HW_NCPU); exit(0); } Am I doing something wrong ? Mathieu ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Creating real bool type for simulation in physics
On Mon, Mar 13, 2006 at 11:13:41AM -0600, Dan Nelson wrote: > In the last episode (Mar 13), Mathieu Prevot said: > > I use freebsd/amd64 (RELENG_6) for simulation in physics. I am > > working on the Ising model: an assembly of spins (micromagnets) which > > interact and which are in one of two states (up or down). Until now I > > use char to define the state of each spin (-1 or 1), however, I > > remarked that most time is spent on memory I/O. Most of bits are > > unused. > > > > I think that if I can use just one bit per spin, I can have something > > much faster. I need advices on how to use it. I guess I can't define > > a new type with a 1/8 byte height (or one bit), yes ? What variable > > (int, char...) do you recommend to use for a sempron 64 bits. I think > > I'll need to define new operators (opaque operators, built with bit > > operators) to switch my spins or use directly the following: & | ^ ~ > > ... > > Take a look at the "bitstring" functions, which let you allocate an > array of "bits" and manipulate them individually. They're documented > in the bitstring manpage. Thank you. bitstring functions (macros) are based on char (8bits) type. This is not ANSI or POSIX, I will include /usr/src/sys/sys/bitstring.h in my program for portability. vi (nvi), and bind9 also use these macros, but are a bit different. -- Mathieu P http://scienceclue.ath.cx ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Creating real bool type for simulation in physics
Hello, I use freebsd/amd64 (RELENG_6) for simulation in physics. I am working on the Ising model: an assembly of spins (micromagnets) which interact and which are in one of two states (up or down). Until now I use char to define the state of each spin (-1 or 1), however, I remarked that most time is spent on memory I/O. Most of bits are unused. I think that if I can use just one bit per spin, I can have something much faster. I need advices on how to use it. I guess I can't define a new type with a 1/8 byte height (or one bit), yes ? What variable (int, char...) do you recommend to use for a sempron 64 bits. I think I'll need to define new operators (opaque operators, built with bit operators) to switch my spins or use directly the following: & | ^ ~ ... May I gain speed using MMX registers or something like this ? How can I do this ? Here is my basic and multithreaded program: http://scienceclue.ath.cx/download/ising_lps_0.2.tar.bz2 Thanks Mathieu P. ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"