gen_windows.ps1 16.3 KB
Newer Older
1
2
#!powershell

3
4
$ErrorActionPreference = "Stop"

Daniel Hiltgen's avatar
Daniel Hiltgen committed
5
6
7
8
function amdGPUs {
    if ($env:AMDGPU_TARGETS) {
        return $env:AMDGPU_TARGETS
    }
Daniel Hiltgen's avatar
Daniel Hiltgen committed
9
    # Current supported rocblas list from ROCm v6.1.2 on windows
Daniel Hiltgen's avatar
Daniel Hiltgen committed
10
    # https://rocm.docs.amd.com/projects/install-on-windows/en/latest/reference/system-requirements.html#windows-supported-gpus
Daniel Hiltgen's avatar
Daniel Hiltgen committed
11
12
13
14
15
16
17
18
19
    $GPU_LIST = @(
        "gfx1030"
        "gfx1100"
        "gfx1101"
        "gfx1102"
    )
    $GPU_LIST -join ';'
}

20

21
function init_vars {
22
23
24
25
26
27
    if (!$script:SRC_DIR) {
        $script:SRC_DIR = $(resolve-path "..\..\")
    }
    if (!$script:llamacppDir) {
        $script:llamacppDir = "../llama.cpp"
    }
Daniel Hiltgen's avatar
Daniel Hiltgen committed
28
29
30
    if (!$script:cmakeTargets) {
        $script:cmakeTargets = @("ollama_llama_server")
    }
Daniel Hiltgen's avatar
Daniel Hiltgen committed
31
32
    $script:cmakeDefs = @(
        "-DBUILD_SHARED_LIBS=on",
33
34
        "-DGGML_NATIVE=off",
        "-DGGML_OPENMP=off"
Daniel Hiltgen's avatar
Daniel Hiltgen committed
35
        )
36
    $script:commonCpuDefs = @("-DCMAKE_POSITION_INDEPENDENT_CODE=on")
37
    $script:ARCH = $Env:PROCESSOR_ARCHITECTURE.ToLower()
38
    $script:DIST_BASE = "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\runners"
39
    md "$script:DIST_BASE" -ea 0 > $null
40
    if ($env:CGO_CFLAGS -contains "-g") {
Daniel Hiltgen's avatar
Daniel Hiltgen committed
41
        $script:cmakeDefs += @("-DCMAKE_VERBOSE_MAKEFILE=on", "-DLLAMA_SERVER_VERBOSE=on", "-DCMAKE_BUILD_TYPE=RelWithDebInfo")
Daniel Hiltgen's avatar
Daniel Hiltgen committed
42
        $script:config = "RelWithDebInfo"
43
    } else {
Daniel Hiltgen's avatar
Daniel Hiltgen committed
44
        $script:cmakeDefs += @("-DLLAMA_SERVER_VERBOSE=off", "-DCMAKE_BUILD_TYPE=Release")
Daniel Hiltgen's avatar
Daniel Hiltgen committed
45
        $script:config = "Release"
46
    }
Daniel Hiltgen's avatar
Daniel Hiltgen committed
47
48
49
    if ($null -ne $env:CMAKE_SYSTEM_VERSION) {
        $script:cmakeDefs += @("-DCMAKE_SYSTEM_VERSION=${env:CMAKE_SYSTEM_VERSION}")
    }
50
51
52
53
54
    # Try to find the CUDA dir
    if ($env:CUDA_LIB_DIR -eq $null) {
        $d=(get-command -ea 'silentlycontinue' nvcc).path
        if ($d -ne $null) {
            $script:CUDA_LIB_DIR=($d| split-path -parent)
55
            $script:CUDA_INCLUDE_DIR=($script:CUDA_LIB_DIR|split-path -parent)+"\include"
56
57
58
59
60
        }
    } else {
        $script:CUDA_LIB_DIR=$env:CUDA_LIB_DIR
    }
    $script:DUMPBIN=(get-command -ea 'silentlycontinue' dumpbin).path
61
62
63
64
65
    if ($null -eq $env:CMAKE_CUDA_ARCHITECTURES) {
        $script:CMAKE_CUDA_ARCHITECTURES="50;52;61;70;75;80"
    } else {
        $script:CMAKE_CUDA_ARCHITECTURES=$env:CMAKE_CUDA_ARCHITECTURES
    }
66
67
68
69
70
71
    # Note: Windows Kits 10 signtool crashes with GCP's plugin
    if ($null -eq $env:SIGN_TOOL) {
        ${script:SignTool}="C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe"
    } else {
        ${script:SignTool}=${env:SIGN_TOOL}
    }
72
73
74
    if ("${env:KEY_CONTAINER}") {
        ${script:OLLAMA_CERT}=$(resolve-path "${script:SRC_DIR}\ollama_inc.crt")
    }
75
76
77
78
79
}

function git_module_setup {
    # TODO add flags to skip the init/patch logic to make it easier to mod llama.cpp code in-repo
    & git submodule init
80
    if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
81
    & git submodule update --force "${script:llamacppDir}"
82
    if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
83
84
85
}

function apply_patches {
86
    # Apply temporary patches until fix is upstream
Michael Yang's avatar
Michael Yang committed
87
88
    foreach ($patch in $(Get-ChildItem "../patches/*.patch")) {
        git -c 'user.name=nobody' -c 'user.email=<>' -C "${script:llamacppDir}" am $patch.FullName
89
    }
90
91
92
}

function build {
93
    write-host "generating config with: cmake -S ${script:llamacppDir} -B $script:buildDir $script:cmakeDefs"
94
    & cmake --version
95
    & cmake -S "${script:llamacppDir}" -B $script:buildDir $script:cmakeDefs
96
    if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
97
98
99
    if ($cmakeDefs -contains "-G") {
        $extra=@("-j8")
    } else {
Daniel Hiltgen's avatar
Daniel Hiltgen committed
100
        $extra= @("--", "/maxCpuCount:8")
101
102
103
    }
    write-host "building with: cmake --build $script:buildDir --config $script:config $($script:cmakeTargets | ForEach-Object { `"--target`", $_ }) $extra"
    & cmake --build $script:buildDir --config $script:config ($script:cmakeTargets | ForEach-Object { "--target", $_ }) $extra
104
    if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
105
106
107
108
    # Rearrange output to be consistent between different generators
    if ($null -ne ${script:config} -And (test-path -path "${script:buildDir}/bin/${script:config}" ) ) {
        mv -force "${script:buildDir}/bin/${script:config}/*" "${script:buildDir}/bin/"
        remove-item "${script:buildDir}/bin/${script:config}"
109
110
111
    }
}

112
113
function sign {
    if ("${env:KEY_CONTAINER}") {
114
115
116
        write-host "Signing ${script:buildDir}/bin/*.exe  ${script:buildDir}/bin/*.dll"
        foreach ($file in @(get-childitem "${script:buildDir}/bin/*.exe") + @(get-childitem "${script:buildDir}/bin/*.dll")){
            & "${script:SignTool}" sign /v /fd sha256 /t http://timestamp.digicert.com /f "${script:OLLAMA_CERT}" `
117
                /csp "Google Cloud KMS Provider" /kc "${env:KEY_CONTAINER}" $file
118
            if ($LASTEXITCODE -ne 0) { exit($LASTEXITCODE)}
119
120
121
122
        }
    }
}

123
124
125
function install {
    write-host "Installing binaries to dist dir ${script:distDir}"
    mkdir ${script:distDir} -ErrorAction SilentlyContinue
126
127
    $binaries = dir "${script:buildDir}/bin/*.exe"
    foreach ($file in $binaries) {
128
        copy-item -Path $file -Destination ${script:distDir} -Force
129
130
    }

131
    write-host "Installing dlls to dist dir ${script:distDir}"
mofanke's avatar
mofanke committed
132
    $dlls = dir "${script:buildDir}/bin/*.dll"
133
    foreach ($file in $dlls) {
134
        copy-item -Path $file -Destination ${script:distDir} -Force
135
    }
136
137
}

138
function cleanup {
139
140
141
142
143
144
145
146
147
148
    $patches = Get-ChildItem "../patches/*.diff"
    foreach ($patch in $patches) {
        # Extract file paths from the patch file
        $filePaths = Get-Content $patch.FullName | Where-Object { $_ -match '^\+\+\+ ' } | ForEach-Object {
            $parts = $_ -split ' '
            ($parts[1] -split '/', 2)[1]
        }

        # Checkout each file
        foreach ($file in $filePaths) {            
149
            git -C "${script:llamacppDir}" checkout $file
150
        }
151
        git -C "${script:llamacppDir}" checkout CMakeLists.txt
152
    }
153
154
}

Daniel Hiltgen's avatar
Daniel Hiltgen committed
155

156
157
158
# -DGGML_AVX -- 2011 Intel Sandy Bridge & AMD Bulldozer
# -DGGML_AVX2 -- 2013 Intel Haswell & 2015 AMD Excavator / 2017 AMD Zen
# -DGGML_FMA (FMA3) -- 2013 Intel Haswell & 2012 AMD Piledriver
159

160

161
function build_static() {
162
    if ((-not "${env:OLLAMA_SKIP_STATIC_GENERATE}") -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "static"))) {
163
164
165
166
167
168
169
170
        # GCC build for direct linking into the Go binary
        init_vars
        # cmake will silently fallback to msvc compilers if mingw isn't in the path, so detect and fail fast
        # as we need this to be compiled by gcc for golang to be able to link with itx
        write-host "Checking for MinGW..."
        # error action ensures we exit on failure
        get-command gcc
        get-command mingw32-make
Daniel Hiltgen's avatar
Daniel Hiltgen committed
171
        $oldTargets = $script:cmakeTargets
172
173
174
175
176
177
        $script:cmakeTargets = @("llama", "ggml")
        $script:cmakeDefs = @(
            "-G", "MinGW Makefiles"
            "-DCMAKE_C_COMPILER=gcc.exe",
            "-DCMAKE_CXX_COMPILER=g++.exe",
            "-DBUILD_SHARED_LIBS=off",
178
179
180
181
182
183
184
            "-DGGML_NATIVE=off",
            "-DGGML_AVX=off",
            "-DGGML_AVX2=off",
            "-DGGML_AVX512=off",
            "-DGGML_F16C=off",
            "-DGGML_FMA=off",
            "-DGGML_OPENMP=off")
185
186
187
        $script:buildDir="../build/windows/${script:ARCH}_static"
        write-host "Building static library"
        build
Daniel Hiltgen's avatar
Daniel Hiltgen committed
188
        $script:cmakeTargets = $oldTargets
189
190
191
    } else {
        write-host "Skipping CPU generation step as requested"
    }
192
}
Daniel Hiltgen's avatar
Daniel Hiltgen committed
193

194
function build_cpu($gen_arch) {
195
    if ((-not "${env:OLLAMA_SKIP_CPU_GENERATE}" ) -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "cpu"))) {
196
197
        # remaining llama.cpp builds use MSVC 
        init_vars
198
        $script:cmakeDefs = $script:commonCpuDefs + @("-A", $gen_arch, "-DGGML_AVX=off", "-DGGML_AVX2=off", "-DGGML_AVX512=off", "-DGGML_FMA=off", "-DGGML_F16C=off") + $script:cmakeDefs
199
200
201
202
203
204
205
206
        $script:buildDir="../build/windows/${script:ARCH}/cpu"
        $script:distDir="$script:DIST_BASE\cpu"
        write-host "Building LCD CPU"
        build
        sign
        install
    } else {
        write-host "Skipping CPU generation step as requested"
207
    }
208
209
210
}

function build_cpu_avx() {
211
    if ((-not "${env:OLLAMA_SKIP_CPU_GENERATE}" ) -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "cpu_avx"))) {
212
        init_vars
213
        $script:cmakeDefs = $script:commonCpuDefs + @("-A", "x64", "-DGGML_AVX=on", "-DGGML_AVX2=off", "-DGGML_AVX512=off", "-DGGML_FMA=off", "-DGGML_F16C=off") + $script:cmakeDefs
214
215
216
217
218
219
220
        $script:buildDir="../build/windows/${script:ARCH}/cpu_avx"
        $script:distDir="$script:DIST_BASE\cpu_avx"
        write-host "Building AVX CPU"
        build
        sign
        install
    } else {
221
        write-host "Skipping CPU AVX generation step as requested"
Jeremy's avatar
Jeremy committed
222
    }
223
}
224

225
function build_cpu_avx2() {
226
    if ((-not "${env:OLLAMA_SKIP_CPU_GENERATE}" ) -and ((-not "${env:OLLAMA_CPU_TARGET}") -or ("${env:OLLAMA_CPU_TARGET}" -eq "cpu_avx2"))) {
227
        init_vars
228
        $script:cmakeDefs = $script:commonCpuDefs + @("-A", "x64", "-DGGML_AVX=on", "-DGGML_AVX2=on", "-DGGML_AVX512=off", "-DGGML_FMA=on", "-DGGML_F16C=on") + $script:cmakeDefs
229
230
231
232
233
234
235
        $script:buildDir="../build/windows/${script:ARCH}/cpu_avx2"
        $script:distDir="$script:DIST_BASE\cpu_avx2"
        write-host "Building AVX2 CPU"
        build
        sign
        install
    } else {
236
        write-host "Skipping CPU AVX2 generation step as requested"
237
    }
238
}
239

240
function build_cuda() {
241
    if ((-not "${env:OLLAMA_SKIP_CUDA_GENERATE}") -and ("${script:CUDA_LIB_DIR}")) {
242
243
        # Then build cuda as a dynamically loaded library
        $nvcc = "$script:CUDA_LIB_DIR\nvcc.exe"
244
        $script:CUDA_VERSION=((get-item ($nvcc | split-path | split-path)).Basename -Split "\.")[0]
245
246
247
248
249
250
        if ($null -ne $script:CUDA_VERSION) {
            $script:CUDA_VARIANT="_"+$script:CUDA_VERSION
        }
        init_vars
        $script:buildDir="../build/windows/${script:ARCH}/cuda$script:CUDA_VARIANT"
        $script:distDir="$script:DIST_BASE\cuda$script:CUDA_VARIANT"
251
252
        $script:cmakeDefs += @(
            "-A", "x64",
253
254
255
            "-DGGML_CUDA=ON",
            "-DGGML_AVX=on",
            "-DGGML_AVX2=off",
Daniel Hiltgen's avatar
Daniel Hiltgen committed
256
            "-DCMAKE_CUDA_FLAGS=-t6",
257
258
            "-DCMAKE_CUDA_ARCHITECTURES=${script:CMAKE_CUDA_ARCHITECTURES}",
            "-DCMAKE_CUDA_COMPILER_TOOLKIT_ROOT=$env:CUDA_PATH"
259
            )
260
261
262
263
264
265
266
267
268
        if ($null -ne $env:OLLAMA_CUSTOM_CUDA_DEFS) {
            write-host "OLLAMA_CUSTOM_CUDA_DEFS=`"${env:OLLAMA_CUSTOM_CUDA_DEFS}`""
            $script:cmakeDefs +=@("${env:OLLAMA_CUSTOM_CUDA_DEFS}")
            write-host "building custom CUDA GPU"
        }
        build
        sign
        install

269
270
271
272
273
        md "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\" -ea 0 > $null
        write-host "copying CUDA dependencies to ${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
        cp "${script:CUDA_LIB_DIR}\cudart64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
        cp "${script:CUDA_LIB_DIR}\cublas64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
        cp "${script:CUDA_LIB_DIR}\cublasLt64_*.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
274
275
    } else {
        write-host "Skipping CUDA generation step"
Daniel Hiltgen's avatar
Daniel Hiltgen committed
276
    }
277
}
Daniel Hiltgen's avatar
Daniel Hiltgen committed
278

Wang,Zhe's avatar
Wang,Zhe committed
279
function build_oneapi() {
280
  if ((-not "${env:OLLAMA_SKIP_ONEAPI_GENERATE}") -and ("${env:ONEAPI_ROOT}"))  {
Wang,Zhe's avatar
Wang,Zhe committed
281
282
283
284
285
286
287
288
289
290
291
    # Get oneAPI version
    $script:ONEAPI_VERSION = icpx --version
    $script:ONEAPI_VERSION = [regex]::Match($script:ONEAPI_VERSION, '(?<=oneAPI DPC\+\+/C\+\+ Compiler )(?<version>\d+\.\d+\.\d+)').Value
    if ($null -ne $script:ONEAPI_VERSION) {
      $script:ONEAPI_VARIANT = "_v" + $script:ONEAPI_VERSION
    }
    init_vars
    $script:buildDir = "../build/windows/${script:ARCH}/oneapi$script:ONEAPI_VARIANT"
    $script:distDir ="$script:DIST_BASE\oneapi$script:ONEAPI_VARIANT"
    $script:cmakeDefs += @(
      "-G", "MinGW Makefiles",
292
      "-DGGML_SYCL=ON",
Wang,Zhe's avatar
Wang,Zhe committed
293
294
295
296
297
298
299
300
301
302
303
304
305
306
      "-DCMAKE_C_COMPILER=icx",
      "-DCMAKE_CXX_COMPILER=icx",
      "-DCMAKE_BUILD_TYPE=Release"
    )

    Write-Host "Building oneAPI"
    build
    # Ninja doesn't prefix with config name
    if ($null -ne $script:DUMPBIN) {
      & "$script:DUMPBIN" /dependents "${script:buildDir}/bin/ollama_llama_server.exe" | Select-String ".dll"
    }
    sign
    install

307
308
309
310
311
312
313
314
315
316
317
    md "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\" -ea 0 > $null
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\libirngmd.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\libmmd.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\pi_level_zero.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\pi_unified_runtime.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\pi_win_proxy_loader.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\svml_dispmd.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\compiler\latest\bin\sycl7.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\mkl\latest\bin\mkl_core.2.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\mkl\latest\bin\mkl_sycl_blas.4.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
    cp "${env:ONEAPI_ROOT}\mkl\latest\bin\mkl_tbb_thread.2.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
Wang,Zhe's avatar
Wang,Zhe committed
318
319
320
321
322
  } else {
    Write-Host "Skipping oneAPI generation step"
  }
}

323
function build_rocm() {
324
    if ((-not "${env:OLLAMA_SKIP_ROCM_GENERATE}") -and ("${env:HIP_PATH}")) {
325
326
327
328
        $script:ROCM_VERSION=(get-item $env:HIP_PATH).Basename
        if ($null -ne $script:ROCM_VERSION) {
            $script:ROCM_VARIANT="_v"+$script:ROCM_VERSION
        }
Daniel Hiltgen's avatar
Daniel Hiltgen committed
329

330
331
332
333
334
335
336
        init_vars
        $script:buildDir="../build/windows/${script:ARCH}/rocm$script:ROCM_VARIANT"
        $script:distDir="$script:DIST_BASE\rocm$script:ROCM_VARIANT"
        $script:cmakeDefs += @(
            "-G", "Ninja", 
            "-DCMAKE_C_COMPILER=clang.exe",
            "-DCMAKE_CXX_COMPILER=clang++.exe",
337
            "-DGGML_HIPBLAS=on",
338
            "-DGGML_CUDA_NO_PEER_COPY=on",
339
            "-DHIP_PLATFORM=amd",
340
341
            "-DGGML_AVX=on",
            "-DGGML_AVX2=off",
342
343
344
345
            "-DCMAKE_POSITION_INDEPENDENT_CODE=on",
            "-DAMDGPU_TARGETS=$(amdGPUs)",
            "-DGPU_TARGETS=$(amdGPUs)"
            )
Daniel Hiltgen's avatar
Daniel Hiltgen committed
346

347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
        # Make sure the ROCm binary dir is first in the path
        $env:PATH="$env:HIP_PATH\bin;$env:PATH"

        # We have to clobber the LIB var from the developer shell for clang to work properly
        $env:LIB=""
        if ($null -ne $env:OLLAMA_CUSTOM_ROCM_DEFS) {
            write-host "OLLAMA_CUSTOM_ROCM_DEFS=`"${env:OLLAMA_CUSTOM_ROCM_DEFS}`""
            $script:cmakeDefs += @("${env:OLLAMA_CUSTOM_ROCM_DEFS}")
            write-host "building custom ROCM GPU"
        }
        write-host "Building ROCm"
        build
        # Ninja doesn't prefix with config name
        ${script:config}=""
        if ($null -ne $script:DUMPBIN) {
            & "$script:DUMPBIN" /dependents "${script:buildDir}/bin/ollama_llama_server.exe" | select-string ".dll"
        }
        sign
        install
366

367
368
369
        md "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\rocblas\library\" -ea 0 > $null
        cp "${env:HIP_PATH}\bin\hipblas.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
        cp "${env:HIP_PATH}\bin\rocblas.dll" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\"
370
        # amdhip64.dll dependency comes from the driver and must be installed on the host to use AMD GPUs
371
        cp "${env:HIP_PATH}\bin\rocblas\library\*" "${script:SRC_DIR}\dist\windows-${script:ARCH}\lib\ollama\rocblas\library\"
372
373
    } else {
        write-host "Skipping ROCm generation step"
374
    }
Daniel Hiltgen's avatar
Daniel Hiltgen committed
375
}
376

377
378
379
380
init_vars
if ($($args.count) -eq 0) {
    git_module_setup
    apply_patches
381
382
383
384
385
386
387
388
389
390
    build_static
    if ($script:ARCH -eq "arm64") {
        build_cpu("ARM64")
    } else { # amd64
        build_cpu("x64")
        build_cpu_avx
        build_cpu_avx2
        build_cuda
        build_oneapi
        build_rocm
391
    }
392

393
394
395
396
397
398
399
400
    cleanup
    write-host "`ngo generate completed.  LLM runners: $(get-childitem -path $script:DIST_BASE)"
} else {
    for ( $i = 0; $i -lt $args.count; $i++ ) {
        write-host "performing $($args[$i])"
        & $($args[$i])
    } 
}