Re: tclforces- tcl extension written in c and built with swig

From: Chris Harrison (charris5_at_gmail.com)
Date: Mon Oct 17 2011 - 18:46:36 CDT

Eva,

Are you sure that:

a) you are using the same namd binary on the parallel compute nodes as
in the serial job?

b) the compute nodes have PATH access to the directory containing
calculate_forces.so (I believe they do, but must check)

c) that the parallel compute nodes are the same architecture as those
used to run the serial job and compile calcuate_forces.so (I suspect
this to be a potential culprit)

Best,
Chris

--
Chris Harrison, Ph.D.
Theoretical and Computational Biophysics Group
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave., Urbana, IL 61801
char_at_ks.uiuc.edu                          Voice: 773-570-0329 
http://www.ks.uiuc.edu/~char              Fax:   217-244-6078
Eva Gonzalez Noya <evanoya_at_uchicago.edu> writes:
> Date: Mon, 17 Oct 2011 18:30:33 -0500
> From: Eva Gonzalez Noya <evanoya_at_uchicago.edu>
> To: namd-l_at_ks.uiuc.edu
> Subject: namd-l: tclforces- tcl extension written in c and built with swig
> User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US;
>  rv:1.9.2.20) Gecko/20110804 Thunderbird/3.1.12
> 
> Hi,
> 
> I am trying to use the tclforces interfase to apply some forces to
> my system.
> To calculate the forces I am using a tcl extension, written in C and
> built using swig. Everything seems to be working fine when I run it
> in a single processor, but when I submit it in parallel I get the error:
> 
> TCL: couldn't load file "./calculate_forces.so":
> ./calculate_forces.so: wrong ELF class: ELFCLASS64
> 
> It seems that while running in parallel namd is not able to find the
> tcl module.
> I tried to specify the full path when loading it, but that doesn't
> seem to be working.
> 
> I attached below detailed information about how I am doing this:
> Any idea about how I can solve this problem?
> 
> Thanks,
> 
> Eva
> 
> 
> I build the tcl module using the directives given in the swig webpage:
> unix % swig -tcl example.i
> unix % gcc -fpic -c example.c example_wrap.c \
>         -I/usr/local/include
> unix % gcc -shared example.o example_wrap.o -o example.so
> 
> and I used the following tcl script:
> 
> 
> load ./calculate_forces.so  calculate_forces
> proc calcforces {} {
>     global lista num  grupo num_monomer
>     loadcoords x
>     set outfile [open coords.xyz w]
>     foreach i $grupo {
>        puts  $outfile "$x($i) "
>     }
>     close $outfile
>     set forces [new_double 21]
>     print "forces now $forces"
>     calculate_forces $forces
>     set lforces [Array2Tcl $forces 21]
> 
>     #print "lforces $lforces"
>     set index 0
>     foreach i $grupo {
>        set j [expr $index*3]
>        set fx [lindex $lforces $j]
>        set fy [lindex $lforces [expr $j+1]]
>        set fz [lindex $lforces [expr $j+2]]
>        set force "$fx $fy $fz"
>        addforce $i $force
>        set index [expr $index+1]
>     }
> }
> 

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:20:54 CST