Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency Updates #256

Merged
merged 22 commits into from
Mar 22, 2023
Merged

Dependency Updates #256

merged 22 commits into from
Mar 22, 2023

Conversation

MattToast
Copy link
Member

Makes the following changes to SmartSim dependencies:

  • RedisAI 1.2.3 is now deprecated
  • Add support for RedisAI 1.2.7 on MacOS
  • Support Python 3.10 (w/o RAI - ONNX backend)

@codecov-commenter
Copy link

codecov-commenter commented Feb 10, 2023

Codecov Report

Merging #256 (16b95a2) into develop (b5bc923) will increase coverage by 0.00%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #256   +/-   ##
========================================
  Coverage    85.21%   85.21%           
========================================
  Files           60       60           
  Lines         3422     3423    +1     
========================================
+ Hits          2916     2917    +1     
  Misses         506      506           
Impacted Files Coverage Δ
smartsim/__init__.py 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

logger.info("Version Information:")
vers = self.versions.as_dict()
print(tabulate(vers, headers=vers.keys(), tablefmt="github"), "\n")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like useful debug info -- why did we take it out?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question!! There was another block roughly 10 lines earlier (~line 146) which was making roughly same print out. I figured two copies was redundant and removed the extra.

I also meant to call that out in the PR description because I figured that would be non-obvious from the diff, but didn't because I forgot and am bad at my job, lol.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there was a before/after display around selecting files for the database Redis/KeyDB. Maybe that was still useful, but we're probably beyond that point now

logger.error("RedisAI support for MacOS is broken in 1.2.4 and 1.2.5")
sys.exit(1)
if self.build_env.PLATFORM == "darwin" and device == "gpu":
raise BuildError("SmartSim does not support GPU on MacOS")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still support RAI 1.2.5, so some of these checks are still needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also something I should have called out in the PR description!!

We were making two very similar sets of checks in two different location: both here and in in Versioner/RedisAIVersion. I decided to try and move as many of the RAI compatibility checks into RedisAIVersioner to try and eliminate the duplication.

Now when RedisAIVersion is instantiated, it will use its knowledge of the platform it is on and the version of python it is running with to try and determine if the RedisAI/ML backends can be installed. If for whatever reason a compatibility inconstancy is found it will raise a SetupError immediately. This means that downstream we should be able to use the instanced RedisAIVersion without the need to make additional compatibility checks.

For instance this will now error out on OSX or with Python==3.10:

$ export SMARTSIM_REDISAI=1.2.5
$ smart build  # same erorr raised at ``pip install`` time as well
# Shortened for brevity
smartsim._core._install.buildenv.SetupError: RedisAI version must be greater than or equal to 1.2.7

But the same scenario will work on linux with Python<=3.9

$ export SMARTSIM_REDISAI=1.2.5
$ smart build
# Shortened for brevity
$ echo $?
0

Do let me know if you think this is acceptable/sufficient change! I could definitely be talked into potentially rolling this back if the changes are deemed "too severe"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds reasonable to me, but let's bring it up in standup tomorrow and make sure the whole team's onboard

Copy link
Contributor

@billschereriii billschereriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looking good, but I think a few checks and some useful debugging code got inadvertantly deleted

@billschereriii
Copy link
Contributor

I'm good with the changes as proposed, but I'm going to hold off on formally approving until another reviewer has a look and agrees or disagrees with the solutions presented in my two unresolved comments

al-rigazzi
al-rigazzi approved these changes Feb 17, 2023
Copy link
Collaborator

@al-rigazzi al-rigazzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As one of our power users is currently hitting an issue trying this branch on his system, I'd suggest we make sure we understand what the problem is before merging.

@al-rigazzi al-rigazzi self-requested a review February 17, 2023 13:59
Copy link
Collaborator

@al-rigazzi al-rigazzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per my last comments, let's make sure users can successfully install SmartSim from source with Python 3.10

@PhilippOffenhaeuser
Copy link

I try to build SmartSim with Python 3.10.4
Looks like some dependencies are broken. I hit two problems.

Problem No. 1:

smart build -v --device cpu                                                                                                                                               [3/1875]
[SmartSim] INFO Running SmartSim build process...                                                                                                                                                                                             
[SmartSim] INFO Checking requested versions...                                                                                                                                                                                                
[SmartSim] INFO Checking for build tools...
[SmartSim] INFO Build Environment:           
| Environment    | Values                                                             |
|----------------|--------------------------------------------------------------------|
| CC             | /opt/hlrs/non-spack/rev-009_2022-09-01/compiler/gcc/10.2.0/bin/gcc |
| CXX            | /opt/hlrs/non-spack/rev-009_2022-09-01/compiler/gcc/10.2.0/bin/g++ |
| CFLAGS         |                                                                    |
| CXXFLAGS       |                                                                    |
| MALLOC         | libc                                                               |
| JOBS           | 1                                                                  |
| PYTHON_VERSION | 3.10.4                                                             |
| PLATFORM       | linux                                                              |

[SmartSim] INFO Version Information:
| Packages   | Versions   |
|------------|------------|
| SMARTSIM   | 0.4.1      |
| SMARTREDIS | 0.3.1      |
| REDIS      | 7.0.5      |
| REDISAI    | 1.2.7      |
| TORCH      | 1.11.0     |
| TENSORFLOW | 2.8.0      |

[SmartSim] INFO Redis build complete!

ML Backends Requested
╒════════════╤═════════════╤═══════╕
│ PyTorch    │ 1.11.0      │ True  │
│ TensorFlow │ 2.8.0       │ True  │
│ ONNX       │ Unavailable │ False │
╘════════════╧═════════════╧═══════╛

Building for GPU support: False

[SmartSim] INFO TensorFlow 2.8.0 installed in Python environment
[SmartSim] INFO Installing packages torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/torch_stable.html...
[SmartSim] ERROR torch==1.11.0+cpu torchvision==0.12.0+cpu -f https://download.pytorch.org/whl/torch_stable.html installation failed with exitcode 1
ERROR: Could not install packages due to an OSError: Missing dependencies for SOCKS support.

WARNING: There was an error checking the latest version of pip.

I fixed the problem by installing torch manually:
pip install torch==1.11.0+cpu --trusted-host [download.pytorch.org](http://download.pytorch.org/) -f https://download.pytorch.org/whl/cpu/torch-1.11.0%2Bcpu-cp310-cp310-linux_x86_64.whl

Second Problem
After installing torch I hit another problem:

[SmartSim] INFO Torch 1.11.0 installed in Python environment                                                                                                                                                                                  
[SmartSim] INFO Building RedisAI version 1.2.7 from https://github.com/RedisAI/RedisAI.git/                                                                                                                                                   
[SmartSim] ERROR + [[ cpu == \c\p\u ]]                                                                                                                                                                                                        
+ GPU=0
+ DEVICE=cpu
+ '[' -f /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/opt/readies/bin/platform ']'
+ '[' -z ']'
++ python3 /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/opt/readies/bin/platform --os
+ OS=linux
+ '[' -z ']'
++ python3 /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/opt/readies/bin/platform --arch
+ ARCH=x64
+ [[ linux == macos ]]
+ DEPS_DIR=/zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/deps/linux-x64-cpu
+ mkdir -p /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/deps/linux-x64-cpu
+ cd /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/deps/linux-x64-cpu
+ [[ '' != 0 ]]
+ [[ ! -d dlpack ]]
+ [[ '' == 1 ]]
++ pwd
+ echo 'Fetch dlpack to /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/RedisAI/deps/linux-x64-cpu ...'
+ git clone -q --depth 1 --branch v0.5_RAI https://github.com/RedisAI/dlpack.git dlpack
+ echo Done.
+ [[ linux == linux ]]
+ TF_OS=linux
+ [[ 0 != 1 ]]
+ TF_BUILD=cpu
+ [[ x64 == x64 ]]
+ TF_ARCH=x86_64
+ LIBTF_URL_BASE=https://storage.googleapis.com/tensorflow/libtensorflow
+ LIBTF_ARCHIVE=libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz
+ [[ 1 != 0 ]]
+ clean_and_fetch libtensorflow libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz
+ product=libtensorflow
+ archive=libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz
+ src_url=https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz
+ no_fetch=
+ [[ '' == 1 ]]
+ [[ '' != 1 ]]
+ [[ -d libtensorflow ]]
++ pwd
+ echo 'Installing libtensorflow from https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz in /zhome/academic/HLRS/hlrs/hpchppof/software/smartsim-devel/smartsim/smartsim/_core/.third-party/R
edisAI/deps/linux-x64-cpu...'
+ [[ ! -e libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz ]]
+ [[ -z '' ]]
+ wget -q https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-2.8.0.tar.gz

@MattToast MattToast self-assigned this Feb 21, 2023
@@ -367,6 +355,11 @@ def install_torch(self, device="cpu"):

def check_onnx_install(self):
"""Check Python environment for ONNX installation"""
if not self.versions.ONNX:
raise SetupError(
"An onnx wheel is not available for this version of python for the "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be friendlier to print the requested Python version here. It would be friendlier yet to state which versions of Python we can support ONNX with.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! I changed the wording to include the current version of python they are using and a brief summary of what combinations of SS and RAI are supported based on their current platform.

return self.defaults[self.version][name]
except KeyError:
raise AttributeError(
f"'{type(self).__name__}' object has no attribute '{name}'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm trying to install and I get this error message, am I going to have any idea what's going on? I think we need to give the user something to go on here -- even if it's just "contact the dev team"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!! Ideally this should never bubble up to a user's view, but on the off chance that it does we should probably give them some direction on where to report it. I added links to out GH issues page and to our community page in our docs

]
# Circumvent a bad `get_deps.sh` script from RAI on 1.2.7 with ONNX
# TODO: Look for a better way to do this or wait for RAI patch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a ticket open against this workaround?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@billschereriii billschereriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR is looking very good! A couple minor changes to messages and creating one new ticket and we're good to go!

Copy link
Contributor

@billschereriii billschereriii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for the updates

Copy link
Member

@ashao ashao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for the thorough job

]
# Circumvent a bad `get_deps.sh` script from RAI on 1.2.7 with ONNX
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it

@MattToast MattToast merged commit fb967d9 into CrayLabs:develop Mar 22, 2023
@MattToast MattToast deleted the update-deps branch March 25, 2023 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants