triton-inference-server/server

Improve RapidJSON support in build

Closed this issue · 7 comments

Is your feature request related to a problem? Please describe.
#945 recently introduced a dependency on RapidJSON in the client examples. However, this dependency is not provided in the build.

Describe the solution you'd like

Describe alternatives you've considered
Currently using:

sed -i 's/add_subdirectory(perf_client)//' CMakeLists.txt

but this is hacky.

Additional context
N/A

This is partially addressed by #1846, thanks @tanmayv25

Coming back to this issue because the rapidjson dependence has increased (now in src/core/json.h, among other places).

When trying to build just the client (using cmake ../server/build/client rather than cmake ../server/build to avoid unwanted external projects; this worked in 1.x releases), the following error occurs:

Scanning dependencies of target http-client-library
make[2]: Leaving directory `/data/pedrok/sonic/v2.3/build/BUILD/slc7_amd64_gcc820/external/triton-inference-server/2.3.0/build'
make  -f src/clients/c++/library/CMakeFiles/http-client-library.dir/build.make src/clients/c++/library/CMakeFiles/http-client-library.dir/build
make[2]: Entering directory `/data/pedrok/sonic/v2.3/build/BUILD/slc7_amd64_gcc820/external/triton-inference-server/2.3.0/build'
[ 47%] Building CXX object src/clients/c++/library/CMakeFiles/http-client-library.dir/http_client.cc.o
In file included from /data/pedrok/sonic/v2.3/build/BUILD/slc7_amd64_gcc820/external/triton-inference-server/2.3.0/triton-inference-server-2.3.0/src/clients/c++/library/http_client.cc:46:
/data/pedrok/sonic/v2.3/build/BUILD/slc7_amd64_gcc820/external/triton-inference-server/2.3.0/triton-inference-server-2.3.0/build/client/../../src/core/json.h:28:10: fatal error: rapidjson/document.h: No such file or directory
 #include <rapidjson/document.h>
          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/clients/c++/library/CMakeFiles/http-client-library.dir/http_client.cc.o] Error 1
make[2]: Leaving directory `/data/pedrok/sonic/v2.3/build/BUILD/slc7_amd64_gcc820/external/triton-inference-server/2.3.0/build'
make[1]: *** [src/clients/c++/library/CMakeFiles/http-client-library.dir/all] Error 2
make[1]: Leaving directory `/data/pedrok/sonic/v2.3/build/BUILD/slc7_amd64_gcc820/external/triton-inference-server/2.3.0/build'
make: *** [all] Error 2

This is even after the RapidJSON cmake config is definitely found. Somehow, the dependency is not declared properly and cmake doesn't propagate the includes.

Adding target_include_directories(http-client-library PUBLIC ${RapidJSON_INCLUDE_DIRS}) in src/clients/c++/library/CMakeLists.txt doesn't help.

You may have noticed that the monolithic triton source and build is is being broken into more focused repos with dedicated builds. The clients will be moved as well (before end of year). Part of that move should simplify the cmake. The existing build isn't meant to be used in the way you are attempting so not sure what is going wrong.

Indeed, this is a bit off the beaten path. I based the procedure on the external project declaration for the client:
https://github.com/triton-inference-server/server/blob/v2.3.0/build/CMakeLists.txt#L433-L455

If the development roadmap includes separating the client from the other components, hopefully this will be resolved in that process. Since I'm only actively using the gRPC client, I've disabled the http client (which has the rapidjson dependency) using TRITON_ENABLE_HTTP.

OK, good that you have a war, and we should revisit once client is in own repo with dedicated cmake build.

While trying to build the server on Windows, getting this error:

19>  Could not find a package configuration file provided by "RapidJSON" with
19>  any of the following names:
19>
19>    RapidJSONConfig.cmake

Wondering why rapidjson is needed, given that it looks like there is another dependency nlohmann-json seems to be included in the build project. Besides, why is rapidjson not found and how to resolve it? Is it not supposed to be automatically downloaded as external?

The rapidjson dependency can be installed like this on windows.

That being said the recommended way of building for windows is detailed here.