1
- # Workflow to run the FTorch test suite
1
+ # Workflow to run the FTorch test suite on Macos platforms
2
2
name : TestSuiteMacOS
3
3
4
4
# Controls when the workflow will run
66
66
toolchain : {compiler: lfortran, version: '0.33.0'}
67
67
- os : macos-13
68
68
toolchain : {compiler: lfortran, version: '0.33.0'}
69
+ defaults :
70
+ run :
71
+ shell : bash -el {0}
69
72
70
73
# Steps represent a sequence of tasks that will be executed as part of the job
71
74
steps :
@@ -86,38 +89,50 @@ jobs:
86
89
env :
87
90
FC : ${{ steps.setup-fortran.outputs.fc }}
88
91
89
- - name : Install Python
90
- uses : actions/setup-python@v5
92
+ # Conda following instructions at https://github.com/conda-incubator/setup-miniconda
93
+ - name : Setup Conda environment
94
+ uses : conda-incubator/setup-miniconda@v3
95
+ continue-on-error : true
91
96
with :
92
- python-version : ' 3.11'
97
+ environment-file : conda/environment_mac.yaml
98
+ activate-environment : ftorch-mac
99
+ miniforge-version : latest
100
+ - name : Check arm64
101
+ run : |
102
+ python -c "import platform; assert platform.machine() == 'arm64', platform.machine()"
103
+
104
+ - name : Check conda
105
+ run : |
106
+ conda info
107
+ conda list
93
108
94
- - name : Install PyTorch
109
+ - name : Install pFUnit
95
110
run : |
96
- python -m pip install --upgrade pip
97
- python -m venv ftorch
98
- . ftorch/bin/activate
99
- pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
111
+ # TODO: Avoid version pinning (needed because version appears in install path)
112
+ git clone -b v4.10.0 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
113
+ mkdir pFUnit/build
114
+ cd pFUnit/build
115
+ cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
116
+ make -j 4 install
100
117
101
118
- name : Build FTorch
102
119
run : |
103
- . ftorch/bin/activate
104
120
VN=$(python -c "import sys; print('.'.join(sys.version.split('.')[:2]))")
105
- export Torch_DIR=${VIRTUAL_ENV}/lib/python${VN}/site-packages
106
- export BUILD_DIR=$(pwd)/src/build
121
+ export BUILD_DIR=$(pwd)/build
107
122
mkdir ${BUILD_DIR}
108
123
cd ${BUILD_DIR}
124
+ python -c 'import torch;print(torch.utils.cmake_prefix_path)'
109
125
cmake .. \
110
- -DPython_EXECUTABLE ="$(which python)" \
126
+ -DCMAKE_PREFIX_PATH ="${CONDA_PREFIX};$( python -c 'import torch;print(torch.utils.cmake_prefix_path)' )" \
111
127
-DCMAKE_BUILD_TYPE=Release \
112
128
-DCMAKE_Fortran_COMPILER=${FC} \
113
129
-DCMAKE_C_COMPILER=${CC} \
114
130
-DCMAKE_CXX_COMPILER=${CXX} \
115
- -DCMAKE_INSTALL_PREFIX=${BUILD_DIR } \
131
+ -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX } \
116
132
-DCMAKE_BUILD_TESTS=TRUE
117
133
cmake --build .
118
134
cmake --install .
119
135
120
136
- name : Integration tests
121
137
run : |
122
- . ftorch/bin/activate
123
138
./run_integration_tests.sh -V
0 commit comments