# TMVA SOFIE: undefined reference to sgemm\_

**URL:** <https://root-forum.cern.ch/t/tmva-sofie-undefined-reference-to-sgemm/47248>\
**Category:** TMVA\
**Created:** [October 15, 2021, 1:14am UTC](https://root-forum.cern.ch/t/tmva-sofie-undefined-reference-to-sgemm/47248 "2021-10-15T01:14:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![qiutt](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/qiutt/32/24795_2.png) [@qiutt](https://root-forum.cern.ch/u/qiutt)\
**Post date:** [October 15, 2021, 1:14am UTC](https://root-forum.cern.ch/t/tmva-sofie-undefined-reference-to-sgemm/47248/1 "2021-10-15T01:14:42Z")

</div>

I am trying to convert a pytorch model to C++ code using the example here: [https://github.com/root-project/root/blob/master/tutorials/tmva/TMVA\_SOFIE\_PyTorch.C](https://github.com/root-project/root/blob/master/tutorials/tmva/TMVA_SOFIE_PyTorch.C).

I can not compile the generated hxx file due to “undefined reference to `sgemm\_’.” When I run interactively, it shows error: “IncrementalExecutor::executeFunction: symbol ‘sgemm\_’ unresolved while linking [cling interface function]!”

The root version I am trying to compile the code with is “6.16/00”. SOFIE is not available in this root, but I sgemm and sgemm are used in the TMVA code. I am working with an ATLAS analysis release so I cannot change packages. Is there any work around?

[PyTorchModel.hxx](https://root-forum.cern.ch/uploads/short-url/yANJk0THPS7JL4ZcHZgKLkANbtV.hxx) (452.2 KB)

---

<div class="post-metadata">

**Author:** ![qiutt](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/qiutt/32/24795_2.png) [@qiutt](https://root-forum.cern.ch/u/qiutt)\
**Post date:** [October 15, 2021, 2:43am UTC](https://root-forum.cern.ch/t/tmva-sofie-undefined-reference-to-sgemm/47248/2 "2021-10-15T02:43:43Z")

</div>

Fix by adding find\_package(LAPACK) to cmake file and link LAPACK\_LIBRARIES.

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [October 15, 2021, 1:22pm UTC](https://root-forum.cern.ch/t/tmva-sofie-undefined-reference-to-sgemm/47248/3 "2021-10-15T13:22:59Z")

</div>

You normally need to link your code using SOFIE with BLAS. If you can use openblas is better than standard bias from Netlib since it is faster.

Lorenzo
