Fail to replace the libnd4jcpu.dll file for using my own custom operations

I successfully compile a new libnd4jcpu.dll, and I want to use the new one in my project. Hence, I replace the old dll file (in C:\Users…javacpp\cache\nd4j-native-1.0.0-M2.1-windows-x86_64.jar\org\nd4j\linalg\cpu\nativecpu\bindings\windows-x86_64) by my new dll file.

However, when I execute the (in dl4j-examples), the new file is deleted and replaced by the old version. Maybe the following step causes this problem?


How can I use my new compiled dll in my project? Need I construct & compile the nd4j project?

(BTW, the official tutorial in indeed does not mention the replacement method)

As a beginner, i am so sorry that i cannot understaned the reply from @agibsonccc :frowning:

@yaoyao just recompile the whole project using mvn -Pcpu. The project automatically compiles libnd4j and nd4j-native in the same build. nd4j-native just bundles whatever is compiled in the libnd4j directory.

Hopefully that makes more sense. Don’t worry about being new. Let’s just make sure we get you what you need.

@yaoyao also of note if you are adding a new c++ op could you please confirm that? If you are I can also show you how to add the new op. If you are just modifying an existing one then it should not be an issue to just use nd4j-native combined with your modifications as above.

Thank u very much.

First, i replace the dll file by the new compiled one in /.javacpp/cache/…

Then, i run ‘mvn -Pcpu compile’ under the dl4j-examples dir, and the outputs are:

But when i run the, the new dll file is still be replaced by the old one :frowning:

In fact, i just add a cout statement in execCustomOp2 to print. I want to use the new compiled dll in the dl4j-examples project. And i dont know how to use the new compiled dll.

@yaoyao Nowhere in our docs do we mention replacing the .cache. Please do not try to innovate here. If you do things our instructions tell you not to do and things I never ask you to do here you just make it harder to help you.

That is because I have to work around what you did but also your understanding of how the library works.

If you fight the library you will just make your own life harder. Just build the exact way I asked you to. The library will do the work for you if you do that.

I’ve told you how to do that multiple times. Please follow the instructions. That will already allow you to use the newer dll.

The DLL is literally bundled in the jar file and as I already mentioned it’s used automatically because the cache is updated every time you start a process.