User Profile

Collapse

Profile Sidebar

Collapse
nimitsis
nimitsis
Last Activity: Feb 21 '08, 02:50 PM
Joined: Aug 7 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Alternation between 2 python threads which do different operation.

    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...
    See more | Go to post

  • nimitsis
    started a topic Python : segmentation fault

    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
    ...
    See more | Go to post

  • 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 ?
    See more | Go to post

    Leave a comment:


  • nimitsis
    started a topic extend python with C embedded python+ Swig

    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;
    ...
    See more | Go to post
    Last edited by bartonc; Oct 5 '07, 07:43 PM.

  • nimitsis
    replied to Python Threads+execute
    Thank you a lot, your advice was helpful. If I find any other relative question , i will write again .
    See more | Go to post

    Leave a comment:


  • nimitsis
    replied to Python Threads+execute
    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...
    See more | Go to post

    Leave a comment:


  • nimitsis
    started a topic Python Threads+execute

    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...
    See more | Go to post
    Last edited by bartonc; Sep 24 '07, 08:20 PM. Reason: Added [CODE=python][/CODE] tags.

  • nimitsis
    started a topic Scientifi Python+MPI

    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",...
    See more | Go to post

  • I try to and it works. Thank you a lot varuns.
    See more | Go to post

    Leave a comment:


  • 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 ;
      PyObject
    ...
    See more | Go to post
    Last edited by bvdet; Mar 19 '14, 03:08 PM. Reason: Add code tags

    Leave a comment:


  • hallo varun
    Thanks for your answer .test_interface _wrap.c is about 2.700 lines .it is helpfull to post it?
    See more | Go to post

    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);...
    See more | Go to post

  • nimitsis
    started a topic Structure C and transform it to Python using Swig

    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"...
    See more | Go to post

  • nimitsis
    started a topic structure C, transform to Python by using Swig

    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"
    ...
    See more | Go to post

  • 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...
    See more | Go to post

    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?
    See more | Go to post
No activity results to display
Show More
Working...