Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add python client example #45

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

wangzhezhe
Copy link
Collaborator

@wangzhezhe wangzhezhe commented Sep 12, 2018

add python wrapper based put.c and get.c. The detail is described in readme.md

dataspaces.conf

## Config file for DataSpaces
ndim = 1
dims = 128

max_versions = 10
lock_type = 1

test output:

(testPython3) [zw241@e3c-070 Python]$ make
[ -f ./numpy.i ] && echo "numpy.i already here, good" || wget https://raw.githubusercontent.com/numpy/numpy/master/tools/swig/numpy.i
numpy.i already here, good
swig -python -I/home1/zw241/testPython3/lib/python3.6/site-packages/mpi4py/include -I/home1/zw241/testPython3/lib/python3.6/site-packages/numpy/core/include -I/home1/zw241/dataspaces/include -o putdata_wrap.c putdata.i
mpicc -fPIC -I/software/python/3.6.3/include/python3.6m -I/home1/zw241/testPython3/lib/python3.6/site-packages/mpi4py/include -I/home1/zw241/testPython3/lib/python3.6/site-packages/numpy/core/include -I/home1/zw241/dataspaces/include ../C/common.o -L/home1/zw241/dataspaces/install/lib -ldspaces -ldart -ldscommon -ldspacesf -lpthread -lm -lrt -libverbs -lrdmacm -o _putdata.cpython-36m-x86_64-linux-gnu.so putdata_wrap.c -shared -lpthread -ldl -lutil -lm
[ -f ./numpy.i ] && echo "numpy.i already here, good" || wget https://raw.githubusercontent.com/numpy/numpy/master/tools/swig/numpy.i
numpy.i already here, good
swig -python -I/home1/zw241/testPython3/lib/python3.6/site-packages/mpi4py/include -I/home1/zw241/testPython3/lib/python3.6/site-packages/numpy/core/include -I/home1/zw241/dataspaces/include -o getdata_wrap.c getdata.i
mpicc -fPIC -I/software/python/3.6.3/include/python3.6m -I/home1/zw241/testPython3/lib/python3.6/site-packages/mpi4py/include -I/home1/zw241/testPython3/lib/python3.6/site-packages/numpy/core/include -I/home1/zw241/dataspaces/include ../C/common.o -L/home1/zw241/dataspaces/install/lib -ldspaces -ldart -ldscommon -ldspacesf -lpthread -lm -lrt -libverbs -lrdmacm -o _getdata.cpython-36m-x86_64-linux-gnu.so getdata_wrap.c -shared -lpthread -ldl -lutil -lm
/bin/bash ./run.sh
array len 3
index 0 value 1.100000
index 0 value 2.200000
index 0 value 3.300000
array len 3
index 0 value 1.100000
index 0 value 2.200000
index 0 value 3.300000
in c file nprocs 2 rank 0
curr ndim is 1
in c file nprocs 2 rank 1
curr ndim is 1

Timestep 0: put data 1.100000 2.200000 3.300000
Timestep 0: put data 1.100000 2.200000 3.300000
'dcg_unlock_on_write()': Rank 1572864: 'dcg_unlock_on_write()':getting lock my_test_lock
'dcg_unlock_on_write()': Rank 1572864: 'dcg_unlock_on_write()':got lock successfully my_test_lock
'dcg_unlock_on_write()': Rank 1572864: 'dcg_unlock_on_write()':getting lock my_test_lock
'dcg_unlock_on_write()': Rank 1572864: 'dcg_unlock_on_write()':got lock successfully my_test_lock
'dcg_unlock_on_write()': Rank 0: 'dcg_unlock_on_write()':requesting unlock my_test_lock
'dcg_free()': num pending = 1.
'dcg_unlock_on_write()': Rank 0: 'dcg_unlock_on_write()':request for unlock my_test_lock sent
'dcg_free()': num pending = 0.
free_gdim_list(): number of user-defined global dimension is 0
free_gdim_list(): number of user-defined global dimension is 0
in c file nprocs 2 rank 0
curr ndim is 1
in c file nprocs 2 rank 1
curr ndim is 1
Timestep 0: get data 1.100000 2.200000 3.300000
'dcg_unlock_on_read()': Rank 0: 'dcg_unlock_on_read()':getting lock my_test_lock
'dcg_unlock_on_read()': Rank 0: 'dcg_unlock_on_read()':got lock successfully my_test_lock
Timestep 0: get data 1.100000 2.200000 3.300000
'dcg_unlock_on_read()': Rank 0: 'dcg_unlock_on_read()':requesting unlock my_test_lock
'dcg_unlock_on_read()': Rank 1: 'dcg_unlock_on_read()':getting lock my_test_lock
'dcg_unlock_on_read()': Rank 1: 'dcg_unlock_on_read()':got lock successfully my_test_lock
'dcg_free()': num pending = 0.
'dcg_unlock_on_read()': Rank 0: 'dcg_unlock_on_read()':request for unlock my_test_lock sent
'dcg_free()': num pending = 0.
free_gdim_list(): number of user-defined global dimension is 0
free_gdim_list(): number of user-defined global dimension is 0
get return data:
[1.1 2.2 3.3]
get return data:
[1.1 2.2 3.3]

@wangzhezhe wangzhezhe force-pushed the python_example branch 3 times, most recently from 6095601 to 6a6cd85 Compare December 20, 2018 17:37
@philip-davis philip-davis self-requested a review December 20, 2018 19:46
@wangzhezhe wangzhezhe force-pushed the python_example branch 11 times, most recently from dab3705 to a8fc266 Compare February 6, 2019 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants