Repository: modin-project/modin

Issue:
BUG: OMP_NUM_THREADS is broken for HDK backend
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
import modin.config

modin.config.IsExperimental.put(True)
modin.config.Engine.put("Native")
modin.config.StorageFormat.put("hdk")

import modin.pandas as pd

print(f"OMP_NUM_THREADS = {os.environ['OMP_NUM_THREADS']}")
```


### Issue Description

`OMP_NUM_THREADS` is set to 1 when the HDK backend is used. Previously, we introduced a fix to set a different `OMP_NUM_THREADS` for OmniSci backend, but now it seems to be broken. This results in performance regressions when HDK is used.

### Expected Behavior

`OMP_NUM_THREADS` is set to a number of available cores

### Error Logs

<details>

```python-traceback

Replace this line with the error backtrace (if applicable).

```

</details>


### Installed Versions

<details>

INSTALLED VERSIONS
------------------
commit           : ee6c6ae752f0890e966777f4d0f5a688db8d0f38
python           : 3.9.13.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.4.0-124-generic
Version          : #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US
LOCALE           : en_US.ISO8859-1

Modin dependencies
------------------
modin            : 0.16.0+30.gee6c6ae7
ray              : None
dask             : None
distributed      : None
hdk              : present

pandas dependencies
-------------------
pandas           : 1.5.0
numpy            : 1.22.4
pytz             : 2022.2.1
dateutil         : 2.8.2
setuptools       : 59.8.0
pip              : 22.2.2
Cython           : 0.29.32
pytest           : 7.1.3
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : None
jinja2           : None
IPython          : None
pandas_datareader: None
bs4              : None
bottleneck       : None
brotli           : None
fastparquet      : None
fsspec           : 2022.8.2
gcsfs            : None
matplotlib       : None
numba            : None
numexpr          : None
odfpy            : None
openpyxl         : None
pandas_gbq       : None
pyarrow          : 6.0.0
pyreadstat       : None
pyxlsb           : None
s3fs             : None
scipy            : 1.9.3
snappy           : None
sqlalchemy       : None
tables           : None
tabulate         : 0.8.9
xarray           : None
xlrd             : None
xlwt             : None
zstandard        : None
tzdata           : None

</details>



Discussion:

Resolving patch:
diff --git a/modin/pandas/__init__.py b/modin/pandas/__init__.py
--- a/modin/pandas/__init__.py
+++ b/modin/pandas/__init__.py
@@ -101,9 +101,6 @@
 
 from modin.config import Engine, Parameter
 
-# Set this so that Pandas doesn't try to multithread by itself
-os.environ["OMP_NUM_THREADS"] = "1"
-
 _is_first_update = {}
 _NOINIT_ENGINES = {
     "Python",
@@ -115,6 +112,9 @@ def _update_engine(publisher: Parameter):
     from modin.config.envvars import IsExperimental
     from modin.config.pubsub import ValueSource
 
+    # Set this so that Pandas doesn't try to multithread by itself
+    os.environ["OMP_NUM_THREADS"] = "1"
+
     sfmt = StorageFormat.get()
 
     if sfmt == "Hdk":


Test patch:
diff --git a/modin/experimental/core/execution/native/implementations/hdk_on_native/test/test_init.py b/modin/experimental/core/execution/native/implementations/hdk_on_native/test/test_init.py
new file mode 100644
--- /dev/null
+++ b/modin/experimental/core/execution/native/implementations/hdk_on_native/test/test_init.py
@@ -0,0 +1,28 @@
+# Licensed to Modin Development Team under one or more contributor license agreements.
+# See the NOTICE file distributed with this work for additional information regarding
+# copyright ownership.  The Modin Development Team licenses this file to you under the
+# Apache License, Version 2.0 (the "License"); you may not use this file except in
+# compliance with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software distributed under
+# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+# ANY KIND, either express or implied. See the License for the specific language
+# governing permissions and limitations under the License.
+
+
+class TestInit:
+    def test_num_threads(self):
+        import os
+        import modin.pandas as pd
+
+        assert "OMP_NUM_THREADS" not in os.environ
+
+        import modin.config as cfg
+
+        cfg.IsExperimental.put(True)
+        cfg.Engine.put("Native")
+        cfg.StorageFormat.put("Hdk")
+        pd.DataFrame()
+        assert os.environ["OMP_NUM_THREADS"] == str(cfg.CpuCount.get())