How to use an environment to run code directly from my workspaceworkingdirectory ?

elias.alberto 1 Reputation point
2022-12-17T05:44:30.623+00:00

I have some code which runs fine on my local machine in a conda environment, but it's super slow (as expected, because I don't have a decent GPU).

I got to Azure ML Studio, got a subscription, made a workspace with all assets needed. Also made a compute cluster with a healthy amount of GPU.
Based on image mcr.microsoft.com/azureml/openmpi4.1.0-cuda11.1-cudnn8-ubuntu18.04 , I built an environment in Azure with the ancient Python 3.6.13, keras 2.1.6 and tensorflow 1.15.5 which are necessary to run my code, and the environment was built without errors.
I've managed to put all the data and code under my workspaceworkingdirectory. I even created a Data Asset that points directly to it.

If I were on my machine, I would now open Anaconda Prompt and do this:

cd myfolder/myscript
conda activate myenv
python script.py <a bunch of parameters>

However, in Azure ML Studio I can't do the same directly from the terminal (outside of the enviroment) because of the dependencies. I also can't run it from the environment I built, because it's not listed there. If I open a terminal and type conda env list, I get this:

base /anaconda
azureml_py310_sdkv2 /anaconda/envs/azureml_py310_sdkv2
azureml_py38 * /anaconda/envs/azureml_py38
azureml_py38_PT_TF /anaconda/envs/azureml_py38_PT_TF

As simple as this issue may seem, I've been struggling for days to get this to run on Azure ML, and I haven't progressed at all. If anyone could point me in the right direction, I'd be immensely grateful.

Edit: Let me clarify one thing: on the Azure ML Studio, if I click on "notebooks" and get the terminal I used to download my code and data to workspaceworkingdirectory, and use that same terminal to invoke conda, I can create an environment and run my code with the same commands I mentioned above, BUT; that environment can't access any GPU acceleration (probably the plain terminal feature is missing the CUDA files, which are present on the docker image used by Azure to generate the proper Conda environment as I initially described). Also that environment manually created at the terminal doesn't seem to be persistent, I had to rebuild it from scratch when I switched computing instances and I might even need to rebuild again every time I restart that compute instance (haven't tested it yet because it's irrelevant unless I get the CUDA acceleration to run)

So, my goal is to get the image-based environment to access the workspaceworkingdirectory and run code there with R+W permissions to write the output files, OR to get cuda working on this environment I built from scratch on the terminal. Also, I need to see the tensorboard in either case.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,334 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.