Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

about porting samples of Tritonserver

47 views
Skip to first unread message

Jack He CN

unread,
Oct 5, 2021, 9:50:08 AM10/5/21
to javacpp
Samuel:

I moved to some simple sample and this one is open source, so I ask questions here.
I followed your advice and modified the file as attached, also the original c++ file is here: https://github.com/triton-inference-server/server/blob/main/src/servers/simple.cc, please help to check, thanks in advance. I only finished about 1/3 of the file, will move on next day.

//jack: how to do with "auto" and "data"??

That's a lambda expression. Implement a FunctionPointer for that like

this:

https://github.com/bytedeco/javacpp-presets/blob/master/nvcodec/samples/src/main/java/org/bytedeco/nvcodec/samples/callback/PfnVideoDecodeCallback.java

 

Although this doesn't seem to be used anywhere by the C++ API, so I think it's OK to use a Java lambda expression for this.

 

//jack: how about the "String" here?

We should be able to use java.lang.String like you did, what isn't working exactly?

 

//jack: how to do with size_t?

Simply use "long"

 

//jack: how to make this in Java?

Those are probably just BytePointer, so do `new BytePointer(...)`

simple.java

Jack He CN

unread,
Oct 5, 2021, 9:55:37 AM10/5/21
to javacpp
one more thing, the samples will use rapidJson. Is it ported by someone to Java? I saw one here: 
but looks like 6 years without update...
Any suggestion about this?

Samuel Audet

unread,
Oct 6, 2021, 1:30:33 AM10/6/21
to javacpp
I'm not aware of any effort to write Java bindings for efficient native JSON libraries, no, but since it doesn't appear to be used for anything important with this sample, so I'd just go with a popular Java solution like Jackson or Gson, which are more appealing to Java developers anyway.

Please let me know when you have more questions!

Samuel

--
You received this message because you are subscribed to the Google Groups "javacpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javacpp-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/javacpp-project/d34a66ca-e02e-4ff1-852a-c9920bfd751dn%40googlegroups.com.

Jack He CN

unread,
Oct 6, 2021, 10:49:29 PM10/6/21
to javacpp
Thanks, Samuel. I need to prepare something else for these two days, will move on with the sample this Friday.

Jack He CN

unread,
Oct 11, 2021, 12:26:21 AM10/11/21
to javacpp
Hi, Samuel:

I spent quite some time to do the sample, but still lots of things dont know how to do. Really need your help. Some of the topics are not so difficult like strcmp, but since I'm short of time (I need to finish this sample by the end of this week), I marked it with "//jack". Today, I will spend some time about how to use Jackson or Gson. If I have more bandwidth, I will try to run the c++ version of this simple first today. Again, thanks for you help, I need to catch up with time:)
 
My plan is: after I finish this sample, I need to talk with some expert of JAVA ecosystem about Spring, Kafka, ElasticSearch, etc. in order to describe some solid scenario to show that Java ecosystem to do inference is quite important, although it's not the key, it's "quite" important.
simple.java
simple.cc

Jack He CN

unread,
Oct 11, 2021, 5:22:04 AM10/11/21
to javacpp
hey, Samuel:

Looks like to change rapidJson to other Java-like Json tool is not very easy for me. But, I installed rapidjson-dev into nvcr.io/nvidia/tritonserver:21.07-py3, I found it is an self included header file lib:

root@872b34da9e75:/usr/include/rapidjson# dpkg-query -L rapidjson-dev
/.
/usr
/usr/include
/usr/include/rapidjson
/usr/include/rapidjson/allocators.h
/usr/include/rapidjson/document.h
/usr/include/rapidjson/encodedstream.h
/usr/include/rapidjson/encodings.h
/usr/include/rapidjson/error
/usr/include/rapidjson/error/en.h
/usr/include/rapidjson/error/error.h
/usr/include/rapidjson/filereadstream.h
/usr/include/rapidjson/filewritestream.h
/usr/include/rapidjson/fwd.h
/usr/include/rapidjson/internal
/usr/include/rapidjson/internal/biginteger.h
/usr/include/rapidjson/internal/diyfp.h
/usr/include/rapidjson/internal/dtoa.h
/usr/include/rapidjson/internal/ieee754.h
/usr/include/rapidjson/internal/itoa.h
/usr/include/rapidjson/internal/meta.h
/usr/include/rapidjson/internal/pow10.h
/usr/include/rapidjson/internal/regex.h
/usr/include/rapidjson/internal/stack.h
/usr/include/rapidjson/internal/strfunc.h
/usr/include/rapidjson/internal/strtod.h
/usr/include/rapidjson/internal/swap.h
/usr/include/rapidjson/istreamwrapper.h
/usr/include/rapidjson/memorybuffer.h
/usr/include/rapidjson/memorystream.h
/usr/include/rapidjson/msinttypes
/usr/include/rapidjson/msinttypes/inttypes.h
/usr/include/rapidjson/msinttypes/stdint.h
/usr/include/rapidjson/ostreamwrapper.h
/usr/include/rapidjson/pointer.h
/usr/include/rapidjson/prettywriter.h
/usr/include/rapidjson/rapidjson.h
/usr/include/rapidjson/reader.h
/usr/include/rapidjson/schema.h
/usr/include/rapidjson/stream.h
/usr/include/rapidjson/stringbuffer.h
/usr/include/rapidjson/writer.h
/usr/lib
/usr/lib/cmake
/usr/lib/cmake/RapidJSON
/usr/lib/cmake/RapidJSON/RapidJSONConfig.cmake
/usr/lib/cmake/RapidJSON/RapidJSONConfigVersion.cmake
/usr/lib/pkgconfig
/usr/lib/pkgconfig/RapidJSON.pc
/usr/share
/usr/share/doc
/usr/share/doc/rapidjson-dev
/usr/share/doc/rapidjson-dev/changelog.Debian.gz
/usr/share/doc/rapidjson-dev/copyright
/usr/share/doc/rapidjson-dev/readme.md.gz

So, I think to use preset to javarize it is an easier way for me to move forward? How do you think of?

Samuel Audet

unread,
Oct 11, 2021, 5:28:22 AM10/11/21
to javacpp...@googlegroups.com
Hi,

I don't think it's going to be easier, but in any case, like I asked you
before, please put all the files that you're working on in your fork
instead of posting them as attachments here!!
https://github.com/bytedeco/javacpp-presets/pull/1085

It's very hard to work with source code on a mailing list. I'll start
looking at the samples you started working on after you've updated your
fork with all the necessary files.

Samuel

Jack He CN

unread,
Oct 11, 2021, 5:33:06 AM10/11/21
to javacpp
You are right. Will do it now:)

Jack He CN

unread,
Oct 11, 2021, 8:26:23 AM10/11/21
to javacpp
Sorry, someone just called me. I updated the PR.

Jack He CN

unread,
Oct 14, 2021, 12:04:19 AM10/14/21
to javacpp
Samuel:

I just trying the one you updated, but found a basic issue:

I compiled tritonserver and looks like it installed here:

[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/target/tritonserver.jar to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6.jar
[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/pom.xml to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6.pom
[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/target/tritonserver-linux-x86_64-gpu.jar to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6-linux-x86_64-gpu.jar
[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/target/tritonserver-linux-x86_64.jar to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6-linux-x86_64.jar
[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/target/tritonserver-linux-x86_64-redist.jar to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6-linux-x86_64-redist.jar
[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/target/tritonserver-sources.jar to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6-sources.jar
[INFO] Installing /workspace/forSimpleSample/javacpp-presets/tritonserver/target/tritonserver-javadoc.jar to /root/.m2/repository/org/bytedeco/tritonserver/2.12-1.5.6/tritonserver-2.12-1.5.6-javadoc.jar

Then, I modified /opt/maven/apache-maven-3.6.
0/conf/settings.xml:

 <localRepository>/root/.m2/repository</localRepository>

But, maven still can not find these jars:

[ERROR] Failed to execute goal on project simple: Could not resolve dependencies for project org.bytedeco.tritonserver:simple:jar:1.5.6: Failure to find org.bytedeco:tritonserver-platform:jar:2.12-1.5.6 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

Why?


Jack He CN

unread,
Oct 14, 2021, 12:32:09 AM10/14/21
to javacpp
fixed this with recompile the tritonserver-platform java:)
Reply all
Reply to author
Forward
0 new messages