Skip to content

Commit 55f13ca

Browse files
committed
Provdb now writes a map of shard index to instance and provider indices for use by the viz
Updated config scripts for benchmark_suite func_multimodal and c_from_python run_services changes: Added viz initialization parameters for multi-instance provDB Committer log output now piped to file rather than through tee to reduce spam Viz initialization now reports error if provDB is disabled
1 parent dfb7101 commit 55f13ca

5 files changed

Lines changed: 52 additions & 11 deletions

File tree

app/provdb_admin.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ int main(int argc, char** argv) {
402402
PSprogressStream << "initialized global DB collections" << std::endl;
403403
}
404404

405+
//Instance 0 writes a map of shard index to server instance and provider index for use by the viz
406+
if(instance == 0) setup.writeShardInstanceMap();
407+
405408
//Write address to file; do this after initializing collections so that the existence of the file can be used to signal readiness
406409
{
407410
std::ofstream f(setup.getInstanceAddressFilename(instance));

benchmark_suite/c_from_python/chimbuko_config.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ chimbuko_services="infer" #The location of the Chimbuko service script. If set t
2626
use_provdb=1 #enable or disable the provDB. If disabled the provenance data will be written as JSON ASCII into the ${provdb_writedir} set below
2727
provdb_extra_args="" #any extra command line arguments to pass
2828
provdb_nshards=4 #number of database shards
29+
provdb_ninstances=1 #number of database server instances. Shards are distributed over instances
2930
provdb_engine="ofi+tcp;ofi_rxm" #the OFI libfabric provider used for the Mochi stack
3031
provdb_port=5000 #the port of the provenance database
31-
provdb_nthreads=4 #number of worker threads; should be >= the number of shards
3232
provdb_writedir=chimbuko/provdb #the directory in which the provenance database is written. Chimbuko creates chimbuko/provdb which can be used as a default
3333
provdb_commit_freq=10000 #frequency ms at which the provenance database is committed to disk. If set to 0 it will commit only at the end
3434

3535
#With "verbs" provider (used for infiniband, iWarp, etc) we need to also specify the domain, which can be found by running fi_info (on a compute node)
3636
provdb_domain=mlx5_0 #only needed for verbs provider <------------ ***SET ME (if using verbs)***
3737

38+
export FI_UNIVERSE_SIZE=1600 # Defines the expected number of provenance DB clients per instance <------------- *** SET ME (should be larger than the number of clients/instance)
39+
export FI_MR_CACHE_MAX_COUNT=0 # disable MR cache in libfabric; still problematic as of libfabric 1.10.1
40+
export FI_OFI_RXM_USE_SRX=1 # use shared recv context in RXM; should improve scalability
3841

3942
####################################
4043
#Options for the parameter server

benchmark_suite/func_multimodal/chimbuko_config.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,18 @@ chimbuko_services="infer" #The location of the Chimbuko service script. If set t
2626
use_provdb=1 #enable or disable the provDB. If disabled the provenance data will be written as JSON ASCII into the ${provdb_writedir} set below
2727
provdb_extra_args="" #any extra command line arguments to pass
2828
provdb_nshards=4 #number of database shards
29+
provdb_ninstances=1 #number of database server instances. Shards are distributed over instances
2930
provdb_engine="ofi+tcp;ofi_rxm" #the OFI libfabric provider used for the Mochi stack
3031
provdb_port=5000 #the port of the provenance database
31-
provdb_nthreads=4 #number of worker threads; should be >= the number of shards
3232
provdb_writedir=chimbuko/provdb #the directory in which the provenance database is written. Chimbuko creates chimbuko/provdb which can be used as a default
3333
provdb_commit_freq=10000 #frequency ms at which the provenance database is committed to disk. If set to 0 it will commit only at the end
3434

3535
#With "verbs" provider (used for infiniband, iWarp, etc) we need to also specify the domain, which can be found by running fi_info (on a compute node)
3636
provdb_domain=mlx5_0 #only needed for verbs provider <------------ ***SET ME (if using verbs)***
3737

38+
export FI_UNIVERSE_SIZE=1600 # Defines the expected number of provenance DB clients per instance <------------- *** SET ME (should be larger than the number of clients/instance)
39+
export FI_MR_CACHE_MAX_COUNT=0 # disable MR cache in libfabric; still problematic as of libfabric 1.10.1
40+
export FI_OFI_RXM_USE_SRX=1 # use shared recv context in RXM; should improve scalability
3841

3942
####################################
4043
#Options for the parameter server
@@ -98,6 +101,11 @@ TAU_ADIOS2_FILE_PREFIX=tau-metrics #the prefix of tau adios2 files; full filena
98101
export TAU_ADIOS2_FILENAME="${TAU_ADIOS2_PATH}/${TAU_ADIOS2_FILE_PREFIX}"
99102

100103
if [[ ${backend_root} == "infer" ]]; then
104+
if [[ $(which provdb_admin) == "" ]]; then
105+
echo "When inferring the backend root directory, could not find provdb_admin in PATH. Please add your Chimbuko bin directory to PATH"
106+
exit 1
107+
fi
108+
101109
backend_root=$( readlink -f $(which provdb_admin | sed 's/provdb_admin//')/../ )
102110
fi
103111

include/chimbuko/provdb/setup.hpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,24 @@ namespace chimbuko{
124124
static inline std::string getGlobalDBname(){
125125
return "provdb.global";
126126
}
127-
127+
128+
129+
/**
130+
* @brief Write a file containing a map of shard index to server instance and provider index
131+
* @param dir The directory to write the file to
132+
*
133+
* Line format is: <shard index> <server instance> <provider index>
134+
*/
135+
inline void writeShardInstanceMap(const std::string &dir = "."){
136+
std::string filename = dir + "/provider.map";
137+
std::ofstream out(filename);
138+
for(int shard=0;shard<m_nshards;shard++){
139+
out << shard << " " << getShardInstance(shard) << " " << getShardProviderIndex(shard) << std::endl;
140+
}
141+
out << "global " << getGlobalDBinstance() << " " << getGlobalDBproviderIndex() << std::endl;
142+
if(!out.good()) fatal_error("Could not write shard instance map");
143+
}
144+
128145

129146
};
130147

scripts/launch/run_services.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ if (( ${use_provdb} == 1 )); then
147147
echo "==========================================="
148148
for((i=0;i<provdb_ninstances;i++)); do
149149
echo "Chimbuko services launching provDB committer ${i} of ${provdb_ninstances}"
150-
provdb_commit "${provdb_dir}" -instance ${i} -ninstances ${provdb_ninstances} -nshards ${provdb_nshards} -freq_ms ${provdb_commit_freq} 2>&1 | tee ${log_dir}/committer_${i}.log &
150+
provdb_commit "${provdb_dir}" -instance ${i} -ninstances ${provdb_ninstances} -nshards ${provdb_nshards} -freq_ms ${provdb_commit_freq} > ${log_dir}/committer_${i}.log 2>&1 &
151151
sleep 1
152152
done
153153
sleep 3
@@ -159,22 +159,32 @@ if (( ${use_viz} == 1 )); then
159159
echo "Chimbuko Services: Error - cannot use viz without the pserver"
160160
exit 1
161161
fi
162-
if ((provdb_ninstances > 1)); then
163-
echo "Chimbuko Services: Error - viz currently does not support multiple provDB instances"
162+
if (( ${use_provdb} == 0 )); then
163+
echo "Chimbuko Services: Error - cannot use viz without the provDB"
164164
exit 1
165165
fi
166166

167-
cd ${viz_dir}
168-
HOST=`hostname`
167+
#Provide parameters for provenance database
168+
export PROVDB_NINSTANCE=${provdb_ninstances}
169169
export SHARDED_NUM=${provdb_nshards}
170-
export PROVDB_ADDR=${prov_add}
170+
export PROVENANCE_DB=${provdb_writedir} #already an absolute path
171+
172+
if (( ${provdb_ninstances} == 1 )); then
173+
#Simpler instantiation if a single server
174+
export PROVDB_ADDR=$(cat ${provdb_dir}/provider.address.0)
175+
echo "Chimbuko Services: viz is connecting to provDB provider 0 on address" $PROVDB_ADDR
176+
else
177+
export PROVDB_ADDR_PATH=$(readlink -f ${provdb_dir})
178+
echo "Chimbuko Services: viz is obtaining provDB addresses from path" $PROVDB_ADDR_PATH
179+
fi
171180

181+
cd ${viz_dir}
182+
HOST=`hostname`
172183
export SERVER_CONFIG="production"
173184
export DATABASE_URL="sqlite:///${viz_dir}/main.sqlite"
174185
export ANOMALY_STATS_URL="sqlite:///${viz_dir}/anomaly_stats.sqlite"
175186
export ANOMALY_DATA_URL="sqlite:///${viz_dir}/anomaly_data.sqlite"
176187
export FUNC_STATS_URL="sqlite:///${viz_dir}/func_stats.sqlite"
177-
export PROVENANCE_DB=${provdb_writedir}
178188
export CELERY_BROKER_URL="redis://${HOST}:${viz_worker_port}"
179189

180190
#Setup redis
@@ -192,7 +202,7 @@ if (( ${use_viz} == 1 )); then
192202
cd ${viz_root}
193203

194204
echo "Chimbuko Services: create db ..."
195-
python3 manager.py createdb
205+
python3 -u manager.py createdb
196206

197207
echo "Chimbuko Services: run redis ..."
198208
redis-server ${viz_dir}/redis.conf

0 commit comments

Comments
 (0)