Skip to content

Commit babf010

Browse files
committed
Adding gitdep file and gitdep in install. also update the deps
1 parent 915f168 commit babf010

File tree

4 files changed

+70
-9
lines changed

4 files changed

+70
-9
lines changed

.gitdeps

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/ https://github.com/CFD-GO/MPI_MPMD.git MPMD.hpp
2+
src/ https://github.com/CFD-GO/RemoteForceInterface.git RemoteForceInterface.cpp RemoteForceInterface.h RemoteForceInterface.hpp

src/MPMD.hpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ inline void MPI_Exchange(void * out, int out_count, void * in, int in_count, MPI
3939

4040
template <typename T> inline MPI_Datatype MPI_Auto_datatype();
4141
template <> inline MPI_Datatype MPI_Auto_datatype< int >() { return MPI_INT; }
42+
template <> inline MPI_Datatype MPI_Auto_datatype< unsigned int >() { return MPI_UNSIGNED; }
43+
template <> inline MPI_Datatype MPI_Auto_datatype< long int >() { return MPI_LONG; }
44+
template <> inline MPI_Datatype MPI_Auto_datatype< unsigned long int >() { return MPI_UNSIGNED_LONG; }
4245
template <> inline MPI_Datatype MPI_Auto_datatype< char >() { return MPI_CHAR; }
43-
template <> inline MPI_Datatype MPI_Auto_datatype< size_t >() { return MPI_LONG; }
4446

4547
template <class T> inline T MPI_Exchange(T& out, MPI_Comm intercomm, MPI_Comm comm) {
4648
T ret;
@@ -57,12 +59,12 @@ inline int MPI_Exchange(int& out, MPI_Comm intercomm, MPI_Comm comm) {
5759

5860
template <class T>
5961
inline T MPI_Exchange_container(T& out, MPI_Comm intercomm, MPI_Comm comm) {
60-
int my_size = out.size();
61-
int other_size = MPI_Exchange(my_size, intercomm, comm);
62-
int mx = my_size;
62+
size_t my_size = out.size();
63+
size_t other_size = MPI_Exchange(my_size, intercomm, comm);
64+
size_t mx = my_size;
6365
if (other_size > mx) mx = other_size;
6466
T ret;
65-
for (int i=0; i<mx; i++) {
67+
for (size_t i=0; i<mx; i++) {
6668
typename T::value_type a,b;
6769
if (i < my_size) a = out[i];
6870
b = MPI_Exchange(a, intercomm, comm);
@@ -83,9 +85,9 @@ inline std::string MPI_Exchange(std::string& out, MPI_Comm intercomm, MPI_Comm c
8385

8486

8587
class MPMDHelper {
86-
static char * char_vec_from_string( std::string str, int size) {
88+
static char * char_vec_from_string( std::string str, size_t size) {
8789
char * ret = new char[size];
88-
int i=0;
90+
size_t i=0;
8991
for (; i<str.size(); i++) ret[i] = str[i];
9092
for (; i<size; i++) ret[i] = '\0';
9193
return ret;

src/RemoteForceInterface.hpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ namespace rfi {
1818
#define safe_MPI_Type_free(datatype) { if ((*datatype) != NULL) MPI_Type_free(datatype); }
1919

2020
template < rfi_type_t TYPE, rfi_rot_t ROT, rfi_storage_t STORAGE, typename rfi_real_t >
21-
RemoteForceInterface < TYPE, ROT, STORAGE, rfi_real_t >::RemoteForceInterface() : workers(0), masters(0), intercomm(MPI_COMM_NULL), totsize(0), ntab(0) {
21+
RemoteForceInterface < TYPE, ROT, STORAGE, rfi_real_t >::RemoteForceInterface() {
22+
workers = 0;
23+
masters = 0;
24+
intercomm = MPI_COMM_NULL;
25+
totsize = 0;
26+
ntab = 0;
2227
connected = false;
2328
active = false;
2429
my_type = TYPE;

tools/install.sh

+53-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ trap rm_tmp EXIT
5454
# --------------- Install functions -------------------------
5555
function try {
5656
comment=$1
57-
log=$(echo $comment | sed 's/ /./g').log
57+
log=$(echo $comment | sed 's|[ /]|.|g').log
5858
shift
5959
if dry
6060
then
@@ -98,6 +98,47 @@ function normal_install {
9898
EOF
9999
}
100100

101+
function gitdep.cp {
102+
echo -n "Copy $1... "
103+
if ! test -f "gitdep_repo/$1"
104+
then
105+
echo "No such file"
106+
exit -1;
107+
fi
108+
if ! test -d "../$2"
109+
then
110+
echo "Targed directory $2 doesn't exist";
111+
exit -1;
112+
fi
113+
if diff gitdep_repo/$1 ../$2 >/dev/null
114+
then
115+
echo "Same"
116+
else
117+
echo "Changed"
118+
if dry
119+
then
120+
echo "cp \"gitdep_repo/$1\" \"../$2\""
121+
else
122+
cp "gitdep_repo/$1" "../$2"
123+
fi
124+
fi
125+
return 0;
126+
}
127+
128+
function gitdep {
129+
DIR=$1
130+
shift
131+
REPO=$1
132+
shift
133+
echo "repo: $REPO dir:$DIR files:$@"
134+
try "Clone $REPO" git clone $REPO gitdep_repo
135+
for i in "$@"
136+
do
137+
gitdep.cp "$i" "$DIR"
138+
done
139+
rm -r gitdep_repo
140+
return 0;
141+
}
101142

102143
# --------------- Main install script -----------------------
103144

@@ -174,6 +215,17 @@ submodules)
174215
try "Updating \"tests\" submodule" git submodule update --init ../tests
175216
try "Loading gitmodules" mv gitmodules ../.gitmodules
176217

218+
;;
219+
gitdep)
220+
if ! test -f "../.gitdeps"
221+
then
222+
echo no .gitdeps file
223+
exit 0;
224+
fi
225+
while read line
226+
do
227+
gitdep $line
228+
done <../.gitdeps
177229
;;
178230
python-dev)
179231
try "Installing python-dev from APT" apt-get install -qq python-dev python-numpy python-sympy

0 commit comments

Comments
 (0)