[Pvfs2-users] How to use pvfs2_open_

Phil Carns carns at mcs.anl.gov
Mon Jun 1 09:28:20 EDT 2009


If you do need to use the PVFS library interface from c++, then you will 
need to replace this:

	#include "pvfs2.h"

with this:

	extern "C" {
		#include "pvfs2.h"
	}

The pvfs header files aren't compatible with c++ out of the box, but 
that extern wrapper will make it work.  As Kyle said, though, in general 
MPI-IO or normal POSIX calls are a better choice unless you need 
specific functionality from the native PVFS interface.

-Phil

Kyle Schochenmaier wrote:
> Nothing will happen with the pvfs2 client, its a dameon.       Instead 
> of using internal pvfs calls you should instead use regular posix io 
> calls as you would on any other filesystem open/close/etc. It is not 
> recommended to use pvfs-open in normal use cases.
> Good luck!
> 
>> On May 30, 2009 12:05 PM, "Ariel Briceño" <aranbrico at gmail.com 
>> <mailto:aranbrico at gmail.com>> wrote:
>>
>> Hi, I have some problems trying to use pvfs2_open
>> I have a small cluster with two computers with pvfs2.
>>
>> Although i need to start the server with
>>
>> /src/local/sbin/pvfs2-server /etc/pvfs2-fs.conf
>>
>> in each machine (both machines are IO servers),
>> when i try to use pvfs2_open in my code like this:
>>
>> ####################################
>> #include <cstdio>
>> #include <iostream>
>> #include <cstdlib>
>> #include "pvfs2.h"
>> #include <sys/types.h>
>> #include <unistd.h>
>> #include <grp.h>
>> #include <pwd.h>
>>
>> // compile with  g++ Read.cpp -L /usr/local/lib/libpvfs2
>>
>> int main( int argc, char **argv)
>> {
>>     //struct    pvfs_filestat pstat;
>>     int    fd;
>>
>>    
>>     char    file[256] = "/mnt/pvfs2/File.map";
>>
>>     if ( fd = pvfs2_open(file) != 0 )
>>     {
>>         perror("open");
>>         return EXIT_FAILURE;
>>     }
>>    
>>     if ( pvfs2_close(fd) < 0 )
>>     {
>>         perror("close");
>>         return EXIT_FAILURE;
>>     }
>>    
>>     return EXIT_SUCCESS;
>> }
>> ###################################
>> the result is
>>
>> Read.cpp:18: error: ‘pvfs2_open’ was not declared in this scope
>> Read.cpp:24: error: ‘pvfs2_close’ was not declared in this scope
>>
>> I mean, i only can do the pvfs2-commands such as pvfs2-cp at the promp and
>> i want to read and write files from my code like this.
>> What is missing?
>> What i'm doing wrong?
>> Do i need to use mpi?
>>
>> Another issue is, although i copied 
>> /usr/src/pvfs-2.8.1/examples/pvfs2-server.rc
>> to /etc/rc.d/init.d/pvfs2-server i can't do 
>> /etc/rc.d/init.d/pvfs2-server start or
>> /etc/rc.d/init.d/pvfs2-server stop. Why is this?
>>
>> Another thing is: Mount the existing PVFS2 volume on the local filesystem.
>> Because i have the /mnt/pvfs2 folder I'm only loading the kernel 
>> module in both machines
>> like
>> insmod /usr/src/pvfs-2.8.1/src/kernel/linux-2.6/pvfs2.ko
>> and in the dmesg output i got
>> ... [17565.529630] pvfs2: module version 2.8.1 loaded
>> In the machine that i want to mount the pvfs2 volume i did
>>
>> cd /usr/src/pvfs-2.8.1/src/apps/kernel/linux/
>> ./pvfs2-client -f -p ./pvfs2-client-core
>>
>> and the result was
>>
>> pvfs2-client starting
>> Spawning new child process
>> Waiting on child with pid 5544
>> About to exec: ./pvfs2-client-core, with args: pvfs2-client-core 
>> --child -a 5 -n 5 --logtype file -L /tmp/pvfs2-client.log
>>
>> but nothing more happened. Whatn is wrong?
>>
>>
>> _______________________________________________
>> Pvfs2-users mailing list
>> Pvfs2-users at beowulf-underground.org 
>> <mailto:Pvfs2-users at beowulf-underground.org>
>> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users
>>
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Pvfs2-users mailing list
> Pvfs2-users at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-users



More information about the Pvfs2-users mailing list