Skip to content

Commit

Permalink
Remove numpy as a dependency (CrayLabs#132)
Browse files Browse the repository at this point in the history
* Remove np from step.py and requirements

Create a helper function called get_base_36_repr so that we can remove numpy from step.py

Remove numpy from requirements.txt

Pin requirements.dev to a specific version of numpy

* Remove numpy from requirements

* Remove numpy from setup

[ committed by @EricGustin ]
[ reviewed by @Spartee ]
  • Loading branch information
EricGustin authored and al-rigazzi committed Jan 31, 2022
1 parent b25fc23 commit a2d1f89
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ smartredis>=0.1.1
redis==3.5.3
redis-py-cluster==2.1.3
sphinx==3.1.1
numpy>=1.18.2
tqdm>=4.50.2
psutil>=5.7.2
tabulate>=0.8.9
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ tabulate>=0.8.9
smartredis>=0.1.1
redis==3.5.3
redis-py-cluster==2.1.3
numpy>=1.18.2
tqdm>=4.50.2
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def has_ext_modules(_placeholder):
"tabulate>=0.8.9",
"redis-py-cluster==2.1.3",
"redis==3.5.3",
"numpy>=1.18.2",
"tqdm>=4.50.2"
]

Expand Down
4 changes: 2 additions & 2 deletions smartsim/_core/launcher/step/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import os.path as osp
import time

import numpy as np
from ...utils.helpers import get_base_36_repr


class Step:
Expand All @@ -41,7 +41,7 @@ def get_launch_cmd(self):
raise NotImplementedError

def _create_unique_name(self, entity_name):
step_name = entity_name + "-" + str(np.base_repr(time.time_ns(), 36))
step_name = entity_name + "-" + get_base_36_repr(time.time_ns())
return step_name

def get_output_files(self):
Expand Down
18 changes: 18 additions & 0 deletions smartsim/_core/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@
import psutil


def get_base_36_repr(positive_int):
"""Converts a positive integer to its base 36 representation
:param positive_int: the positive integer to convert
:type positive_int: int
:return: base 36 representation of the given positive int
:rtype: str
"""
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
result = []

while positive_int:
next_digit = digits[positive_int % 36]
result.append(next_digit)
positive_int //= 36

return "".join(reversed(result))


def get_ip_from_host(host):
"""Return the IP address for the interconnect.
Expand Down

0 comments on commit a2d1f89

Please sign in to comment.