Repository: mlcommons/inference
Issue: Facing issues with Pybind11 while setting MLperf inference on Jetson Xavier
Root cause: Configuration Error

While setting up MLperf inference on Jetson board using 
**cd ../../loadgen; CFLAGS="-std=c++14" python3 setup.py develop**, keeping stumbling onto the following issue,
![image](https://user-images.githubusercontent.com/13655465/138068699-425b753b-c31f-4b5b-b8f8-fbd057cfaf44.png)

I've installed and uninstalled pybind11-dev several times so for without any solution so far

Have you done a recursive clone of the mlcommons repo and use the one from here https://github.com/mlcommons/inference/blob/349efa1dbefca38e30edd64baeb84743b423c62b/.gitmodules#L6?

Yes, I have used the same version of pybind along with recursive clone. I do encounter another challenge while using recursive clone, 
![image](https://user-images.githubusercontent.com/13655465/138130226-c579ca50-6ea2-4559-babf-736d89b7c438.png)



Please update the URL `https://github.com/mlperf/power-dev` to `https://github.com/mlcommons/power-dev`

Thanks. Was able to install power-dev but I am still facing the first issue. For more context, I am using  Ubuntu 18.04.5 LTS on Jetson Xavier AGX.  Python version is 3.6.9. 
![image](https://user-images.githubusercontent.com/13655465/138253855-18d08cf8-f706-4f05-8138-38f4dc4e8988.png)


Hmm could you share what gcc version you have? This is the gcc version I am using:

```
pohanh@computelab-65:~$ gcc --version
gcc (Ubuntu/Linaro 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

Its the same version as yours 
![image](https://user-images.githubusercontent.com/13655465/138304193-c4138279-9b4b-44c1-949b-3a386b8efd00.png)


okay.... I will try to repro your issue tomorrow. Could you tell me your JetPack version, inference repo commit hash, and your build command? I will try exactly same steps on my Xavier board. Thanks

Thanks! Here are the details requested,
![image](https://user-images.githubusercontent.com/13655465/138309272-74159efb-3719-4884-ac4f-ad403058eff3.png)

Commit hash for inference repo : 349efa1dbefca38e30edd64baeb84743b423c62b 
I'm using this notebook as a reference : https://github.com/mlcommons/inference/blob/r1.1/vision/classification_and_detection/GettingStarted.ipynb

build command : cd ../../loadgen; CFLAGS="-std=c++14" python3 setup.py develop

Also I tried running this inside a virtual environment as well as root. Same error in both cases. Let me know if you need any other information

Thanks. Will be you an update if I have a repro or if I cannot repro. Also ++ @psyhtest  since he may have been using this code path.

Sure, thank you!

@MohanaRC I cannot repro the failure.... your command works perfectly on my Xavier board.

Could you provide the outputs of these commands to make sure we have the same environment?

```
cd ../third_party/pybind && git branch && cd ../../loadgen
md5sum ../third_party/pybind/include/pybind11/detail/common.h
cat ../third_party/pybind/include/pybind11/detail/common.h | grep PYBIND11_MODULE
```

Mine looks like this:

```
pohanh@computelab-65:~/pohanh/mlperf-inference-xavier/closed/NVIDIA/build/inference/loadgen$ cd ../third_party/pybind && git branch && cd ../../loadgen
* (HEAD detached at 25abf7ef)
  master
pohanh@computelab-65:~/pohanh/mlperf-inference-xavier/closed/NVIDIA/build/inference/loadgen$ md5sum ../third_party/pybind/include/pybind11/detail/common.h
6def849452f1b0a73ab81616f0989a2f  ../third_party/pybind/include/pybind11/detail/common.h
pohanh@computelab-65:~/pohanh/mlperf-inference-xavier/closed/NVIDIA/build/inference/loadgen$ cat ../third_party/pybind/include/pybind11/detail/common.h | grep PYBIND11_MODULE
    ***Deprecated in favor of PYBIND11_MODULE***
    PYBIND11_DEPRECATED("PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE")  \
        PYBIND11_MODULE(example, m) {
#define PYBIND11_MODULE(name, variable)                                        \
```

I reinstalled pybind 11 again. Adding screenshot of installation commands along with paths,

mohana@tameesh-xaviernx:\~/inference/loadgen$ pip3 install pytest
mohana@tameesh-xaviernx:\~/inference/loadgen$ git clone https://github.com/pybind                                                                                                            /pybind11.git
Output for this, 
![image](https://user-images.githubusercontent.com/13655465/138857632-49fcef69-8e74-44de-b759-20bfac7fd376.png)

Followed this with,
mohana@tameesh-xaviernx:\~/inference/loadgen$ cd pybind11
mohana@tameesh-xaviernx:\~/inference/loadgen/pybind11$ mkdir build
mohana@tameesh-xaviernx:\~/inference/loadgen/pybind11$ cd build
mohana@tameesh-xaviernx:\~/inference/loadgen/pybind11/build$ cmake ..
mohana@tameesh-xaviernx:\~/inference/loadgen/pybind11/build$ sudo make install
Received no errors till this but when I try out the commands you posted earlier, I get the following error. Am I installing pybind in a different folder?

Here's a screenshot
![image](https://user-images.githubusercontent.com/13655465/138856787-f6387c65-7afc-4025-9bc1-8b555f8fbed3.png)




@MohanaRC this repo has a submodule at `third_party/pybind`. You should call `cd <path/to/repo/root> && rm -rf third_party/pybind && git submodule update --init third_party/pybind` to update the submodule before building the loadgen. Do NOT clone the pybind11 repo manually.

Here is where the submodule is located: https://github.com/mlcommons/inference/tree/master/third_party

I am slightly confused. In one of the earlier responses I was suggested to use git clone recursive first and then use a specific version of pybind. Clone recursive failed because the power dev module was moved to a different location and pybind I had used as per the URL. @nvpohanh could you share what steps you used to set up on your jetson? I'll remove all previous installations and replicate the steps you have used to set it up 

@MohanaRC Alternatively, could you try `cd third_party/pybind && git checkout 25abf7efba0b2990f5a6dfb0a31bc65c0f2f4d17`? Basically, our code does not work with master-branch pybind11, but pybind at `25abf7efba0b2990f5a6dfb0a31bc65c0f2f4d17` this commit hash.

> Clone recursive failed because the power dev module was moved to a different location

This should have been fixed on latest master branch.

@MohanaRC Is this issue resolved?

@rnaidu02 yes, I have been able to install it. The issues were fixed on the latest branch. Earlier the clone recursive was failing because of the issue with power dev module. I installed it separately along with pybind which was of a different commit as @nvpohanh had mentioned earlier. Latest branch didn't have that issue so it worked.