hello
I have a problem, which in C is simple to get through of it, but in python seems not so easy to me. I have 2 python threads. Each one do a different work. The first do a computation in a variable and the second send the value of the variable to an other processor, via MPI and receive a new one.
The main problem is that the computation thread must be executed first and the communication thread must follows and the alternation...
User Profile
Collapse
-
Python : segmentation fault
Hello everyone
I try to extend Python using a simple C wrapped module . This module includes embedded python code and it is product of Swig . The corresponding files follows :
...Code://main.c #include "Python.h" #include <stdio.h> int main() { Py_Initialize(); PyRun_SimpleString("execfile('simple.py') \n"); Py_Finalize(); return -
Hello again
Did anyone knows if Swig support wrapping C code with embedded Python code? To do that is any special declarations that I have to introduce at interface file ? -
extend python with C embedded python+ Swig
Hello everyone
I am trying to use a module , which I have create by using Swig. This module has C code with embedded Python . The relative code follows :
[CODE=c]
// main.c
#include "Python.h"
#include <stdio.h>
int main()
{
Py_Initialize() ;
PyRun_SimpleStr ing("execfile(' aplo.py') \n");
Py_Finalize();
return 0;
...Last edited by bartonc; Oct 5 '07, 07:43 PM. -
Thank you a lot, your advice was helpful. If I find any other relative question , i will write again .Leave a comment:
-
Hello bartonc
Thank you for your advices, I appreciate it much, but still I have some questions. Does Parallel Python solve problems for concurrent execution of threads? As I read, Parallel Python used to solve problems for parallelism between processors,like MPI does. But my problem refer to parallel execution of 2 threads at the same processor, which execute different functions. Threads use shared memory communication so both of them can...Leave a comment:
-
Python Threads+execute
Hello to everyone
I wont to create 2 threads in Python ( thread01, thread02 ), which doing the follows :
thread01, ask user to give a value to flag variable and write it to the shared memory of two threads
thread02, read from shared memory and check if the flag have a specific value .
The corresponding python code follows:
[CODE=python]
import time
import thread
import threading
import... -
Scientifi Python+MPI
Hello everyone
The point of my work is to run a python program at a cluster with MPI communication, so I use Python Scientific module 2.4.11 . I have installed the Scientific and the MPI module according to instructions at each node of cluster. When I execute mpi.py at the cluster the following message appears :
nimitsis@centau rus:~> mpipython mpi.py
Traceback (most recent call last):
File "mpi.py",... -
-
Hallo again verun
I hope the following code of interface_wrap. c is helpful.Thank you again.
...Code:extern "C" { #endif SWIGINTERN PyObject *_wrap_main(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; int arg1 ; char **arg2 = (char **) 0 ; int result; int val1 ; int ecode1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; PyObjectLeave a comment:
-
hallo varun
Thanks for your answer .test_interface _wrap.c is about 2.700 lines .it is helpfull to post it?Leave a comment:
-
pass a text file , as argument of main() in Python
Hallo everyone,
I'm trying to convert a main function from C to Python,by using Swig and call it with a .txt argument.The code is the following :
[CODE=c]
/*test.c*/
#include <stdio.h>
int main(int argc, char ** argv)
{
float f1,f2,f3;
FILE *fp;
fp=fopen(argv[1],"r");
if(fp!=NULL)
{
printf("Succesf ull opening\n");
fscanf(fp,"%f\n %f\n%f",&f1,&f2 ,&f3);... -
Structure C and transform it to Python using Swig
Hello
I am trying to convert and manage a simple structure C ,to Python by using SWIG. The code is the following :
/* example.c*/
double sum(Vector c)
{
return c.x+c.y+c.z;
}
/*header.h*/
struct Vector{
double x,y,z;
}
/*interface_file .i*/
%module interface
%{
#include "structure. h"
%}
#include "structure. h"... -
structure C, transform to Python by using Swig
Hello
I am trying to convert and manage a simple structure C ,to Python by using C. The code is the following :
/* example.c*/
double sum(Vector c)
{
return c.x+c.y+c.z;
}
/*header.h*/
struct Vector{
double x,y,z;
}
/*interface_file .i*/
%module interface
%{
#include "structure. h"
%}
#include "structure. h"
... -
Hi and thanks for reporting.
I'm trying to import mpi module in python2.5(kubun tu 7.04)
%python
>>>import mpi
and the above message present. I have download the module pyMPI-2.4b4.tar.tar from sourceforge.net ,extract it and install it according to README instructions(./configure, make, make check, python softload_setup. py install).The mpi.so file exist to /usr/lib/python2.5/site-packages directory but according...Leave a comment:
-
undefined symbol: MPI_Get_version in mpi.so on kubuntu 7.04
HELP!!!!
when i am trying to import mpi in python the following message presents:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python2.5/site-packages/mpi.so: undefined symbol: MPI_Get_version
what can i do?
No activity results to display
Show More
Leave a comment: