# Building package for a different OS

**URL:** <https://community.konduit.ai/t/building-package-for-a-different-os/349>\
**Category:** DL4J\
**Created:** [March 31, 2020, 1:51pm UTC](https://community.konduit.ai/t/building-package-for-a-different-os/349 "2020-03-31T13:51:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![torstenbm](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/torstenbm/32/101_2.png) [@torstenbm](https://community.konduit.ai/u/torstenbm)\
**Post date:** [March 31, 2020, 1:51pm UTC](https://community.konduit.ai/t/building-package-for-a-different-os/349/1 "2020-03-31T13:51:25Z")

</div>

My development computer is a MacBook Pro, and I am using it along with DL4J to build deep learning based User Defined Functions for a Big Data Management System deployed on a cluster of linux machines with NVIDIA GPU’s.

Because I am building on my MacBook Pro, Maven tries to pull the macosx-x86\_64-version of cuda-10.1, which I believe doesn’t exist as NVIDIA has dropped support for OSX, rendering me with the following error:

> [ERROR] Failure to find org.nd4j:nd4j-cuda-10.1:jar:macosx-x86\_64:1.0.0-beta6 in [Central Repository:](https://repo.maven.apache.org/maven2) was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced → [Help 1]

So as of now my current workflow is to code on my MacBook Pro, push to a repo, pull it on one of the servers on the cluster, run `mvn package` there (where it builds without error), then deploy it.

Would it be possible to build it directly for a linux machine on my MacBook Pro?

---

<div class="post-metadata">

**Author:** ![raver119](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@raver119](https://community.konduit.ai/u/raver119)\
**Post date:** [March 31, 2020, 2:18pm UTC](https://community.konduit.ai/t/building-package-for-a-different-os/349/2 "2020-03-31T14:18:38Z")

</div>

You can bundle both nd4j-native-platform and nd4j-cuda-x.x-platform, so in runtime we’ll pick appropriate backend. On your mbp it’ll be nd4j-native, and on server it’ll be nd4j-cuda

---

<div class="post-metadata">

**Author:** ![torstenbm](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/torstenbm/32/101_2.png) [@torstenbm](https://community.konduit.ai/u/torstenbm)\
**Post date:** [April 2, 2020, 2:16am UTC](https://community.konduit.ai/t/building-package-for-a-different-os/349/3 "2020-04-02T02:16:04Z")

</div>

Cool.

Out of curiosity how does it pick the appropriate backend when they are all added as dependencies?

---

<div class="post-metadata">

**Author:** ![raver119](https://avatars.discourse-cdn.com/v4/letter/r/9de053/32.png) [@raver119](https://community.konduit.ai/u/raver119)\
**Post date:** [April 2, 2020, 4:15am UTC](https://community.konduit.ai/t/building-package-for-a-different-os/349/4 "2020-04-02T04:15:09Z")

</div>

CUDA is considered to have higher priority, so if GPU is available - it’ll be loaded first. If it’s not available, initialization will fail and nd4j-native will be loaded after that.

---

<div class="post-metadata">

**Author:** ![saudet](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/saudet/32/69_2.png) [@saudet](https://community.konduit.ai/u/saudet)\
**Post date:** [April 15, 2020, 10:11am UTC](https://community.konduit.ai/t/building-package-for-a-different-os/349/5 "2020-04-15T10:11:33Z")

</div>

There are also environment variables for this, from [https://nd4j.org/backend:](https://nd4j.org/backend:)

> For enabling different backends at runtime, you set the priority with your environment via the environment variable:
> 
> ```auto
> BACKEND_PRIORITY_CPU=SOME_NUM
> BACKEND_PRIORITY_GPU=SOME_NUM
> 
> ```
> 
> Relative to the priority, it will allow you to dynamically set the backend type. More can be found [here](https://deeplearning4j.org/gpu#setting-environment-variables-backend_priority_cpu-and-backend_priority_gpu)
