Skip to content

Commit aef01c1

Browse files
Merge pull request #169 from cwlacewe/master
v2.8.0 Release
2 parents b038fe0 + 3776b5b commit aef01c1

File tree

109 files changed

+8351
-1378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+8351
-1378
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ tmp
99
# VS Code Specific
1010
.devcontainer
1111
.vscode
12-
.coverage
12+
.coverage
13+
14+
# Jetbrains Specific
15+
.idea

CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,28 @@ else()
5656
add_subdirectory(tests)
5757
add_subdirectory(src/vcl)
5858
add_subdirectory(client/cpp)
59-
add_subdirectory(ext/custom_vcl)
6059
add_subdirectory(distributed)
6160

6261
link_directories(/usr/local/lib /usr/lib/x86_64-linux-gnu/)
6362
include_directories(/usr/include/jsoncpp utils/include/ src/pmgd/include src/pmgd/util include/ src/vcl /usr/include ${CMAKE_CURRENT_BINARY_DIR}/utils/src/protobuf)
6463
add_library(dms SHARED
64+
src/BackendNeo4j.cc
6565
src/BoundingBoxCommand.cc
6666
src/BlobCommand.cc
6767
src/CommunicationManager.cc
6868
src/DescriptorsCommand.cc
6969
src/DescriptorsManager.cc
7070
src/ExceptionsCommand.cc
7171
src/ImageCommand.cc
72+
src/Neo4jBaseCommands.cc
73+
src/Neo4JHandlerCommands.cc
74+
src/OpsIOCoordinator.cc
7275
src/PMGDIterators.cc
7376
src/PMGDQuery.cc
7477
src/PMGDQueryHandler.cc
7578
src/QueryHandlerExample.cc
7679
src/QueryHandlerBase.cc
80+
src/QueryHandlerNeo4j.cc
7781
src/QueryHandlerPMGD.cc
7882
src/QueryMessage.cc
7983
src/RSCommand.cc
@@ -85,7 +89,7 @@ else()
8589
src/ImageLoop.cc
8690
src/VideoLoop.cc
8791
)
88-
target_link_libraries(dms vcl pmgd pmgd-util protobuf tbb tiledb vdms-utils pthread -lcurl -lzmq ${AWSSDK_LINK_LIBRARIES})
92+
target_link_libraries(dms vcl pmgd pmgd-util protobuf tbb tiledb vdms-utils pthread -lcurl -lzmq ${AWSSDK_LINK_LIBRARIES} neo4j-client)
8993
add_executable(vdms src/vdms.cc)
9094
target_link_libraries(vdms dms vdms_protobuf vcl tiledb faiss flinng jsoncpp ${OpenCV_LIBS} ${AWSSDK_LINK_LIBRARIES})
9195
endif ()

INSTALL.md

+72-11
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Here we will install the Debian/Ubuntu packages.
1010
sudo apt-get update -y --fix-missing
1111
sudo apt-get upgrade -y
1212
sudo apt-get install -y --no-install-suggests --no-install-recommends \
13-
apt-transport-https autoconf automake bison build-essential bzip2 ca-certificates \
13+
apt-transport-https automake bison build-essential bzip2 ca-certificates \
1414
curl ed flex g++-9 gcc-9 git gnupg-agent javacc libarchive-tools libatlas-base-dev \
1515
libavcodec-dev libavformat-dev libboost-all-dev libbz2-dev libc-ares-dev libcurl4-openssl-dev \
16-
libdc1394-22-dev libgflags-dev libgoogle-glog-dev libgtk-3-dev libgtk2.0-dev \
16+
libncurses5-dev libdc1394-22-dev libgflags-dev libgoogle-glog-dev libgtk-3-dev libgtk2.0-dev \
1717
libhdf5-dev libjpeg-dev libjsoncpp-dev libleveldb-dev liblmdb-dev \
1818
liblz4-dev libopenblas-dev libopenmpi-dev libpng-dev librdkafka-dev libsnappy-dev libssl-dev \
1919
libswscale-dev libtbb-dev libtbb2 libtiff-dev libtiff5-dev libtool libzmq3-dev linux-libc-dev mpich \
@@ -80,6 +80,20 @@ cd $VDMS_DEP_DIR/CMake
8080
make ${BUILD_THREADS}
8181
sudo make install
8282
```
83+
***NOTE:*** If multiple versions of Python 3 are present on your system, verify you are using Python3.9 or higher. You can specify the specific verison in above command and also set the following with your specific version: `alias python3=/usr/bin/python3.x`.
84+
85+
86+
#### **Autoconf v2.71**
87+
```bash
88+
AUTOCONF_VERSION="2.71"
89+
curl -L -o $VDMS_DEP_DIR/autoconf-${AUTOCONF_VERSION}.tar.xz https://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.xz
90+
cd $VDMS_DEP_DIR
91+
tar -xf autoconf-${AUTOCONF_VERSION}.tar.xz
92+
cd autoconf-${AUTOCONF_VERSION}
93+
./configure
94+
make ${BUILD_THREADS}
95+
sudo make install
96+
```
8397

8498

8599
#### **Protobuf v24.2 (4.24.2)**
@@ -90,38 +104,44 @@ git clone -b v${PROTOBUF_VERSION} --recurse-submodules https://github.com/protoc
90104

91105
cd $VDMS_DEP_DIR/protobuf/third_party/googletest
92106
mkdir build && cd build
93-
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \
107+
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release \
108+
-DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local \
94109
-DBUILD_GMOCK=ON -DCMAKE_CXX_STANDARD=17 ..
95110
make ${BUILD_THREADS}
96111
sudo make install
97-
sudo ldconfig
98112

99113
cd $VDMS_DEP_DIR/protobuf/third_party/abseil-cpp
100114
mkdir build && cd build
101-
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_PREFIX_PATH=/usr/local/ -DCMAKE_INSTALL_PREFIX=/usr/local/ \
102-
-DABSL_BUILD_TESTING=ON -DABSL_ENABLE_INSTALL=ON -DABSL_USE_EXTERNAL_GOOGLETEST=ON \
115+
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON \
116+
-DCMAKE_INSTALL_PREFIX=/usr/local -DABSL_BUILD_TESTING=ON \
117+
-DABSL_USE_EXTERNAL_GOOGLETEST=ON \
103118
-DABSL_FIND_GOOGLETEST=ON -DCMAKE_CXX_STANDARD=17 ..
104119
make ${BUILD_THREADS}
105120
sudo make install
121+
sudo ldconfig /usr/local/lib
106122

107123
cd $VDMS_DEP_DIR/protobuf
108-
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_CXX_STANDARD=17 \
109-
-Dprotobuf_ABSL_PROVIDER=package -DCMAKE_PREFIX_PATH=/usr/local .
124+
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=/usr/local \
125+
-DCMAKE_CXX_STANDARD=17 -Dprotobuf_BUILD_SHARED_LIBS=ON \
126+
-Dprotobuf_ABSL_PROVIDER=package \
127+
-Dprotobuf_BUILD_TESTS=ON \
128+
-Dabsl_DIR=/usr/local/lib/cmake/absl .
110129
make ${BUILD_THREADS}
111130
sudo make install
112131

113132
python3 -m pip install --no-cache-dir "protobuf==4.${PROTOBUF_VERSION}"
114133
```
115134

116135

117-
#### **Faiss v1.7.3**
136+
#### **Faiss v1.7.4**
118137
Install the Faiss library for similarity search.
119138
```bash
120-
FAISS_VERSION="v1.7.3"
139+
FAISS_VERSION="v1.7.4"
121140
git clone --branch ${FAISS_VERSION} https://github.com/facebookresearch/faiss.git $VDMS_DEP_DIR/faiss
122141
cd $VDMS_DEP_DIR/faiss
123142
mkdir build && cd build
124-
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=/usr/bin/python3 ..
143+
cmake -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=/usr/bin/python3 \
144+
-DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..
125145
make ${BUILD_THREADS}
126146
sudo make install
127147
```
@@ -192,6 +212,40 @@ cmake -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF -D CMAKE_BUILD_TYPE=RELEASE -D
192212
make ${BUILD_THREADS}
193213
sudo make install
194214
```
215+
216+
217+
#### **Neo4j Client**
218+
Below are instructions for installing ***libneo4j-omni*** which requires Peg, libcypher-parser and libedit as dependencies.
219+
```bash
220+
PEG_VERSION="0.1.19"
221+
curl -L -o $VDMS_DEP_DIR/peg-${PEG_VERSION}.tar.gz https://github.com/gpakosz/peg/releases/download/${PEG_VERSION}/peg-${PEG_VERSION}.tar.gz
222+
cd $VDMS_DEP_DIR/
223+
tar -xf peg-${PEG_VERSION}.tar.gz
224+
cd peg-${PEG_VERSION}
225+
make ${BUILD_THREADS}
226+
sudo make install
227+
228+
git clone https://github.com/cleishm/libcypher-parser.git $VDMS_DEP_DIR/libcypher
229+
cd $VDMS_DEP_DIR/libcypher
230+
./autogen.sh
231+
./configure
232+
sudo make install
233+
234+
LIBEDIT_VERSION="20230828-3.1"
235+
curl -L -o $VDMS_DEP_DIR/libedit-${LIBEDIT_VERSION}.tar.gz https://thrysoee.dk/editline/libedit-${LIBEDIT_VERSION}.tar.gz
236+
cd $VDMS_DEP_DIR/
237+
tar -xzf libedit-${LIBEDIT_VERSION}.tar.gz
238+
cd libedit-${LIBEDIT_VERSION}
239+
./configure
240+
make ${BUILD_THREADS}
241+
sudo make install
242+
243+
git clone https://github.com/majensen/libneo4j-omni.git $VDMS_DEP_DIR/libomni
244+
cd $VDMS_DEP_DIR/libomni
245+
./autogen.sh
246+
./configure --disable-werror --prefix=/usr
247+
sudo make install -w --debug
248+
```
195249
<br>
196250

197251
## Install VDMS
@@ -216,3 +270,10 @@ cmake -DCMAKE_CXX_FLAGS='-DPM' ..
216270
make ${BUILD_THREADS}
217271
```
218272

273+
***NOTE:*** If error similar to `cannot open shared object file: No such file or directory` obtained during loading shared libraries, such as `libpmgd.so` or `libvcl.so`, add the correct directories to `LD_LIBRARY_PATH`. This may occur for non-root users. To find the correct directory, run `find` command for missing object file. An example solution for missing `libpmgd.so` and `libvcl.so` is:
274+
```bash
275+
find / -name "libpmgd*so*" # <Path_to_VDMS_directory>/build/src/pmgd/src
276+
find / -name "libvcl*so*" # <Path_to_VDMS_directory>/build/src/vcl
277+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:<Path_to_VDMS_directory>/build/src/pmgd/src:<Path_to_VDMS_directory>/build/src/vcl
278+
```
279+

client/cpp/CMakeLists.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
cmake_minimum_required (VERSION 3.10)
22
project(vdms_client)
33
find_package( OpenCV REQUIRED )
4+
find_package(Protobuf CONFIG REQUIRED)
45
find_package( Threads REQUIRED )
56
include_directories(../../utils/include/ )
67

78

8-
add_library( vdms-client SHARED
9-
VDMSClient.cc
10-
CSVParserUtil.cpp
11-
)
9+
add_library(vdms-client SHARED VDMSClient.cc CSVParserUtil.cpp)
1210
target_link_libraries(vdms-client protobuf vdms_protobuf vdms-utils pthread ${CMAKE_THREAD_LIBS_INIT} )
1311

client/cpp/CSVParser.h

+36-17
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,52 @@ class CSVParser {
1414
int port)
1515
: m_filename(filename), m_num_threads(num_threads), vdms_server(server),
1616
vdms_port(port) {}
17+
~CSVParser() {}
18+
1719
std::vector<VDMS::Response>
1820
parse_csv_lines(const std::string &filename, int start_line, int end_line,
19-
std::mutex &mutex, std::vector<VDMS::Response> &all_results,
21+
std::vector<VDMS::Response> &local_results,
2022
const size_t thread_id) {
21-
rapidcsv::Document csv(filename);
2223

23-
size_t rowCount = csv.GetRowCount();
24+
rapidcsv::Document csv(filename);
2425
std::vector<std::string> columnNames = csv.GetColumnNames();
2526
VDMS::CSVParserUtil csv_util(vdms_server, vdms_port, columnNames,
2627
static_cast<int>(thread_id));
27-
for (int i = start_line; i < end_line; ++i) {
28+
for (int i = start_line; i <= end_line - 1; ++i) {
2829
std::vector<std::string> row = csv.GetRow<std::string>(i);
2930
VDMS::Response result = csv_util.parse_row(row);
31+
if (local_results.empty()) {
32+
// If local_results is empty, resize it to have at least one element
33+
local_results.resize(1);
34+
} else if (i - start_line >= static_cast<int>(local_results.size())) {
35+
// If the index is beyond the current size, resize to accommodate the
36+
// index
37+
local_results.resize(i - start_line + 1);
38+
}
3039

31-
std::lock_guard<std::mutex> lock(mutex);
32-
all_results.push_back(result);
40+
// Replace the value at the specified index in local_results
41+
local_results[i - start_line] = result;
3342
}
3443

35-
return all_results;
44+
return local_results;
3645
}
37-
std::vector<VDMS::Response> parse() {
38-
auto start = std::chrono::high_resolution_clock::now();
3946

47+
std::vector<VDMS::Response> parse() {
4048
std::ifstream file(m_filename);
41-
if (!file) {
42-
std::cerr << "Error opening file\n";
49+
if (!file.is_open()) {
50+
std::cerr << "Error opening file: " << m_filename << std::endl;
4351
}
44-
4552
int num_lines = std::count(std::istreambuf_iterator<char>(file),
4653
std::istreambuf_iterator<char>(), '\n');
54+
file.close();
55+
4756
std::size_t lines_per_thread = num_lines / m_num_threads;
4857

4958
std::mutex mutex;
5059
std::vector<std::thread> threads;
51-
std::vector<VDMS::Response> all_results;
60+
std::vector<std::vector<VDMS::Response>> all_local_results(m_num_threads);
61+
std::vector<VDMS::Response> all_results; // Local vector for each thread
62+
all_results.reserve(num_lines);
5263

5364
for (size_t i = 0; i < m_num_threads; i++) {
5465
size_t start_line = i * lines_per_thread;
@@ -57,16 +68,24 @@ class CSVParser {
5768

5869
threads.emplace_back(&CSVParser::parse_csv_lines, this,
5970
std::ref(m_filename), start_line, end_line,
60-
std::ref(mutex), std::ref(all_results), i);
71+
std::ref(all_local_results[i]), i);
6172
}
6273

6374
for (auto &thread : threads) {
6475
thread.join();
6576
}
77+
size_t allResultsSizeBefore = all_results.size();
78+
for (const auto &local_results : all_local_results) {
79+
80+
// Extend the size of all_results to accommodate local_results
81+
all_results.resize(all_results.size() + local_results.size());
82+
83+
// Copy elements from local_results to the appropriate positions in
84+
// all_results
85+
std::copy(local_results.begin(), local_results.end(),
86+
all_results.begin() + allResultsSizeBefore);
87+
}
6688

67-
auto finish = std::chrono::high_resolution_clock::now();
68-
std::chrono::duration<double> elapsed = finish - start;
69-
// std::cout << "Elapsed time: " << elapsed.count() << " s\n";
7089
return all_results;
7190
}
7291

client/cpp/CSVParserUtil.cpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <jsoncpp/json/json.h>
1212
#include <mutex>
1313
#include <sstream>
14-
static std::mutex barrier;
14+
1515
std::mutex mtx;
1616
using namespace std;
1717
using namespace std::chrono;
@@ -46,7 +46,6 @@ void VDMS::CSVParserUtil::initCommandsMap() {
4646
{"RectangleUpdate", RectangleUpdate}};
4747
}
4848
string VDMS::CSVParserUtil::function_accessing_columnNames(int i) {
49-
std::lock_guard<std::mutex> lock(mtx);
5049

5150
return _columnNames[i];
5251
}
@@ -146,7 +145,6 @@ VDMS::CSVParserUtil::commandType
146145
VDMS::CSVParserUtil::get_query_type(const string &str) {
147146
CSVParserUtil::commandType querytype = commandType::UNKNOWN;
148147

149-
std::lock_guard<std::mutex> lock(CSVParserUtil::querytype_mutex);
150148
std::map<std::string, QueryType>::iterator iter;
151149
iter = commands.find(str);
152150
if (iter != commands.end()) {
@@ -173,8 +171,6 @@ VDMS::CSVParserUtil::get_query_type(const string &str) {
173171
querytype = commandType::AddBoundingBox;
174172
break;
175173
}
176-
// std::cout << " I executed queryType "<< querytype << std::endl;
177-
// return querytype;
178174
}
179175

180176
return querytype;
@@ -200,9 +196,7 @@ void VDMS::CSVParserUtil::parseProperty(const string &columnNames,
200196
const string &row,
201197
const string &queryType,
202198
Json::Value &aquery) {
203-
std::lock_guard<std::mutex> lock(CSVParserUtil::aquery_mutex);
204199
string propname = columnNames.substr(5, string::npos);
205-
// std::cout << "Inside parseProp " << propname <<std::endl;
206200
CSVParserUtil::DATATYPE dtype = getDataType(row, propname);
207201
if (dtype == DATATYPE::DATE) {
208202
Json::Value date;
@@ -224,7 +218,6 @@ void VDMS::CSVParserUtil::parseProperty(const string &columnNames,
224218
void VDMS::CSVParserUtil::parseConstraints(const string &columnNames,
225219
const string &row, string &queryType,
226220
Json::Value &aquery) {
227-
std::lock_guard<std::mutex> lock(CSVParserUtil::cons_mutex);
228221
vector<string> consvals = spiltrow(row);
229222
string consname = consvals[0];
230223
if (consname.substr(0, 5) == "date:") {
@@ -284,7 +277,6 @@ void VDMS::CSVParserUtil::parseOperations(string columnNames, string row,
284277
string queryType,
285278
Json::Value &aquery) {
286279

287-
std::lock_guard<std::mutex> lock(CSVParserUtil::ops_mutex);
288280
string type = columnNames.substr(4, string::npos);
289281
Json::Value opsjson;
290282
vector<string> opsKeys;
@@ -424,13 +416,6 @@ VDMS::CSVParserUtil::DATATYPE VDMS::CSVParserUtil ::isValidDataType(string data,
424416
int type) {
425417
CSVParserUtil::DATATYPE actualtype = getDataType(data, "");
426418
return actualtype;
427-
428-
// if(type==2 && (actualt=3 || acype=tualtype==4))//2 is for num
429-
// return actualtype;
430-
// else if(type==1 && (actualtype==1 || actualtype==2))//1 is for bool
431-
// return actualtype;
432-
// else
433-
// return -1;
434419
}
435420

436421
bool VDMS::CSVParserUtil::isValidOpsType(string &type) {
@@ -542,6 +527,5 @@ VDMS::Response
542527
VDMS::CSVParserUtil::send_to_vdms(const Json::Value &query,
543528
const std::vector<std::string *> blobs) {
544529
Json::StyledWriter _fastwriter;
545-
546530
return vdms_client->query(_fastwriter.write(query), blobs);
547531
}

client/cpp/CSVParserUtil.h

-4
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ class CSVParserUtil {
9797
std::string vdms_server;
9898
int vdms_port;
9999
std::vector<std::string> _columnNames;
100-
std::mutex querytype_mutex;
101-
std::mutex aquery_mutex;
102-
std::mutex cons_mutex;
103-
std::mutex ops_mutex;
104100
int id;
105101
std::unique_ptr<VDMS::VDMSClient> vdms_client;
106102
};

0 commit comments

Comments
 (0)