YARN 3 and Spark: allocate a GPU
I can't find the working Spark option to require executors with a GPU.
I'm trying to setup a HADOOP cluster in order to run Machine Learning algorithms on available GPUs via Spark.
So far I'm trying out my setup with a minimal cluster (1 resource manager and 2 node managers (each with 8cores, 32Gb RAM, 1 Nvidia GPU), everybody running Ubuntu 18.04.
Resource discovery is working as expected (I see my 16 cores, 56Gb memory and 2 yarn.io/gpu)
The documentation provides a way, by using "--conf spark.yarn.executor.resource.yarn.io/gpu=1" but this does not work for me (no effect at all, both in spark-submit command parameter or in $SPARK_CONF/metrics.properties).
As YARN 3 is the first one to provide GPU isolation, I try to avoid a rollback to an older(/more documented) version.
I guess this could be set in code through SparkContext and would be happy to know how, but as I'm more on the admin side than ML engineer, I rather set this in conf files once and for all. Anyway at this point, any solution would be appreciated.
Anyone happy to provide the good syntax to allocate GPU with resources isolation enabled ?
Love you guys,
Kevin
(Yarn 3.1.1/3.2.0 on HortonWorks HDP)
gpu cluster hadoop
add a comment |
I can't find the working Spark option to require executors with a GPU.
I'm trying to setup a HADOOP cluster in order to run Machine Learning algorithms on available GPUs via Spark.
So far I'm trying out my setup with a minimal cluster (1 resource manager and 2 node managers (each with 8cores, 32Gb RAM, 1 Nvidia GPU), everybody running Ubuntu 18.04.
Resource discovery is working as expected (I see my 16 cores, 56Gb memory and 2 yarn.io/gpu)
The documentation provides a way, by using "--conf spark.yarn.executor.resource.yarn.io/gpu=1" but this does not work for me (no effect at all, both in spark-submit command parameter or in $SPARK_CONF/metrics.properties).
As YARN 3 is the first one to provide GPU isolation, I try to avoid a rollback to an older(/more documented) version.
I guess this could be set in code through SparkContext and would be happy to know how, but as I'm more on the admin side than ML engineer, I rather set this in conf files once and for all. Anyway at this point, any solution would be appreciated.
Anyone happy to provide the good syntax to allocate GPU with resources isolation enabled ?
Love you guys,
Kevin
(Yarn 3.1.1/3.2.0 on HortonWorks HDP)
gpu cluster hadoop
add a comment |
I can't find the working Spark option to require executors with a GPU.
I'm trying to setup a HADOOP cluster in order to run Machine Learning algorithms on available GPUs via Spark.
So far I'm trying out my setup with a minimal cluster (1 resource manager and 2 node managers (each with 8cores, 32Gb RAM, 1 Nvidia GPU), everybody running Ubuntu 18.04.
Resource discovery is working as expected (I see my 16 cores, 56Gb memory and 2 yarn.io/gpu)
The documentation provides a way, by using "--conf spark.yarn.executor.resource.yarn.io/gpu=1" but this does not work for me (no effect at all, both in spark-submit command parameter or in $SPARK_CONF/metrics.properties).
As YARN 3 is the first one to provide GPU isolation, I try to avoid a rollback to an older(/more documented) version.
I guess this could be set in code through SparkContext and would be happy to know how, but as I'm more on the admin side than ML engineer, I rather set this in conf files once and for all. Anyway at this point, any solution would be appreciated.
Anyone happy to provide the good syntax to allocate GPU with resources isolation enabled ?
Love you guys,
Kevin
(Yarn 3.1.1/3.2.0 on HortonWorks HDP)
gpu cluster hadoop
I can't find the working Spark option to require executors with a GPU.
I'm trying to setup a HADOOP cluster in order to run Machine Learning algorithms on available GPUs via Spark.
So far I'm trying out my setup with a minimal cluster (1 resource manager and 2 node managers (each with 8cores, 32Gb RAM, 1 Nvidia GPU), everybody running Ubuntu 18.04.
Resource discovery is working as expected (I see my 16 cores, 56Gb memory and 2 yarn.io/gpu)
The documentation provides a way, by using "--conf spark.yarn.executor.resource.yarn.io/gpu=1" but this does not work for me (no effect at all, both in spark-submit command parameter or in $SPARK_CONF/metrics.properties).
As YARN 3 is the first one to provide GPU isolation, I try to avoid a rollback to an older(/more documented) version.
I guess this could be set in code through SparkContext and would be happy to know how, but as I'm more on the admin side than ML engineer, I rather set this in conf files once and for all. Anyway at this point, any solution would be appreciated.
Anyone happy to provide the good syntax to allocate GPU with resources isolation enabled ?
Love you guys,
Kevin
(Yarn 3.1.1/3.2.0 on HortonWorks HDP)
gpu cluster hadoop
gpu cluster hadoop
edited Feb 15 at 10:44
Kévin Azoulay
asked Dec 24 '18 at 16:35
Kévin AzoulayKévin Azoulay
64
64
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
As Spark doesn't like much YARN resources as of hadoop 3.0.0 (Spark is said to work with Hadoop 2.6+ but it implicitly means "up to 3.0 excluded"), a workaround was to set yarn.resource-types.yarn.io/gpu.minimum-allocation to 1, and from within my python code, cancel the executor order (spark doesn't launch the AM with 0 executor asked from command line)
sc = SparkContext(conf=SparkConf().setAppName("GPU on AM only").set("spark.executor.instances", 0))
Ugly but sufficient for our current workloads, hoping for a "Spark for Hadoop 3.0+" distribution soon enough.
EDIT: You can compile Spark for Hadoop 3.1 profile, from the current state of their github repository, then you have access to the spark.yarn..resource.yarn.io/gpu properties !
I'll share my findings about isolation here too:
After about 2 weeks of various tries we finally settled on a full wipe of every host for a clean install from scratch.
Still nothing working.
Then we tried a "one worker" setup to set a countable resource manually to try the allocation mechanism and then....
NOTHING hortonWORKS !
But my Googling was better suited then.
It seems to be a Hadoop related issue about custom resources and CapacityScheduler, enjoy:
https://issues.apache.org/jira/browse/YARN-9161
https://issues.apache.org/jira/browse/YARN-9205
For now (3.1.1/3.2.0) the capacity.CapacityScheduler is broken by a hardcoded enum containing only vCores and RAM parameters.
You just have to switch your scheduler class to org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
You also want to replace "capacity" by "Fair" in the line
yarn.scheduler.fair.resource-calculator=org.apache.hadoop.yarn.util.resource.DominantResourceCalculator
Your GPUs will not be visible on yarn ui2 but will still be on the NodeManagers, and most importantly, will be allocated properly.
It was a mess to find out indeed.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1387424%2fyarn-3-and-spark-allocate-a-gpu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
As Spark doesn't like much YARN resources as of hadoop 3.0.0 (Spark is said to work with Hadoop 2.6+ but it implicitly means "up to 3.0 excluded"), a workaround was to set yarn.resource-types.yarn.io/gpu.minimum-allocation to 1, and from within my python code, cancel the executor order (spark doesn't launch the AM with 0 executor asked from command line)
sc = SparkContext(conf=SparkConf().setAppName("GPU on AM only").set("spark.executor.instances", 0))
Ugly but sufficient for our current workloads, hoping for a "Spark for Hadoop 3.0+" distribution soon enough.
EDIT: You can compile Spark for Hadoop 3.1 profile, from the current state of their github repository, then you have access to the spark.yarn..resource.yarn.io/gpu properties !
I'll share my findings about isolation here too:
After about 2 weeks of various tries we finally settled on a full wipe of every host for a clean install from scratch.
Still nothing working.
Then we tried a "one worker" setup to set a countable resource manually to try the allocation mechanism and then....
NOTHING hortonWORKS !
But my Googling was better suited then.
It seems to be a Hadoop related issue about custom resources and CapacityScheduler, enjoy:
https://issues.apache.org/jira/browse/YARN-9161
https://issues.apache.org/jira/browse/YARN-9205
For now (3.1.1/3.2.0) the capacity.CapacityScheduler is broken by a hardcoded enum containing only vCores and RAM parameters.
You just have to switch your scheduler class to org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
You also want to replace "capacity" by "Fair" in the line
yarn.scheduler.fair.resource-calculator=org.apache.hadoop.yarn.util.resource.DominantResourceCalculator
Your GPUs will not be visible on yarn ui2 but will still be on the NodeManagers, and most importantly, will be allocated properly.
It was a mess to find out indeed.
add a comment |
As Spark doesn't like much YARN resources as of hadoop 3.0.0 (Spark is said to work with Hadoop 2.6+ but it implicitly means "up to 3.0 excluded"), a workaround was to set yarn.resource-types.yarn.io/gpu.minimum-allocation to 1, and from within my python code, cancel the executor order (spark doesn't launch the AM with 0 executor asked from command line)
sc = SparkContext(conf=SparkConf().setAppName("GPU on AM only").set("spark.executor.instances", 0))
Ugly but sufficient for our current workloads, hoping for a "Spark for Hadoop 3.0+" distribution soon enough.
EDIT: You can compile Spark for Hadoop 3.1 profile, from the current state of their github repository, then you have access to the spark.yarn..resource.yarn.io/gpu properties !
I'll share my findings about isolation here too:
After about 2 weeks of various tries we finally settled on a full wipe of every host for a clean install from scratch.
Still nothing working.
Then we tried a "one worker" setup to set a countable resource manually to try the allocation mechanism and then....
NOTHING hortonWORKS !
But my Googling was better suited then.
It seems to be a Hadoop related issue about custom resources and CapacityScheduler, enjoy:
https://issues.apache.org/jira/browse/YARN-9161
https://issues.apache.org/jira/browse/YARN-9205
For now (3.1.1/3.2.0) the capacity.CapacityScheduler is broken by a hardcoded enum containing only vCores and RAM parameters.
You just have to switch your scheduler class to org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
You also want to replace "capacity" by "Fair" in the line
yarn.scheduler.fair.resource-calculator=org.apache.hadoop.yarn.util.resource.DominantResourceCalculator
Your GPUs will not be visible on yarn ui2 but will still be on the NodeManagers, and most importantly, will be allocated properly.
It was a mess to find out indeed.
add a comment |
As Spark doesn't like much YARN resources as of hadoop 3.0.0 (Spark is said to work with Hadoop 2.6+ but it implicitly means "up to 3.0 excluded"), a workaround was to set yarn.resource-types.yarn.io/gpu.minimum-allocation to 1, and from within my python code, cancel the executor order (spark doesn't launch the AM with 0 executor asked from command line)
sc = SparkContext(conf=SparkConf().setAppName("GPU on AM only").set("spark.executor.instances", 0))
Ugly but sufficient for our current workloads, hoping for a "Spark for Hadoop 3.0+" distribution soon enough.
EDIT: You can compile Spark for Hadoop 3.1 profile, from the current state of their github repository, then you have access to the spark.yarn..resource.yarn.io/gpu properties !
I'll share my findings about isolation here too:
After about 2 weeks of various tries we finally settled on a full wipe of every host for a clean install from scratch.
Still nothing working.
Then we tried a "one worker" setup to set a countable resource manually to try the allocation mechanism and then....
NOTHING hortonWORKS !
But my Googling was better suited then.
It seems to be a Hadoop related issue about custom resources and CapacityScheduler, enjoy:
https://issues.apache.org/jira/browse/YARN-9161
https://issues.apache.org/jira/browse/YARN-9205
For now (3.1.1/3.2.0) the capacity.CapacityScheduler is broken by a hardcoded enum containing only vCores and RAM parameters.
You just have to switch your scheduler class to org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
You also want to replace "capacity" by "Fair" in the line
yarn.scheduler.fair.resource-calculator=org.apache.hadoop.yarn.util.resource.DominantResourceCalculator
Your GPUs will not be visible on yarn ui2 but will still be on the NodeManagers, and most importantly, will be allocated properly.
It was a mess to find out indeed.
As Spark doesn't like much YARN resources as of hadoop 3.0.0 (Spark is said to work with Hadoop 2.6+ but it implicitly means "up to 3.0 excluded"), a workaround was to set yarn.resource-types.yarn.io/gpu.minimum-allocation to 1, and from within my python code, cancel the executor order (spark doesn't launch the AM with 0 executor asked from command line)
sc = SparkContext(conf=SparkConf().setAppName("GPU on AM only").set("spark.executor.instances", 0))
Ugly but sufficient for our current workloads, hoping for a "Spark for Hadoop 3.0+" distribution soon enough.
EDIT: You can compile Spark for Hadoop 3.1 profile, from the current state of their github repository, then you have access to the spark.yarn..resource.yarn.io/gpu properties !
I'll share my findings about isolation here too:
After about 2 weeks of various tries we finally settled on a full wipe of every host for a clean install from scratch.
Still nothing working.
Then we tried a "one worker" setup to set a countable resource manually to try the allocation mechanism and then....
NOTHING hortonWORKS !
But my Googling was better suited then.
It seems to be a Hadoop related issue about custom resources and CapacityScheduler, enjoy:
https://issues.apache.org/jira/browse/YARN-9161
https://issues.apache.org/jira/browse/YARN-9205
For now (3.1.1/3.2.0) the capacity.CapacityScheduler is broken by a hardcoded enum containing only vCores and RAM parameters.
You just have to switch your scheduler class to org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler
You also want to replace "capacity" by "Fair" in the line
yarn.scheduler.fair.resource-calculator=org.apache.hadoop.yarn.util.resource.DominantResourceCalculator
Your GPUs will not be visible on yarn ui2 but will still be on the NodeManagers, and most importantly, will be allocated properly.
It was a mess to find out indeed.
edited Feb 27 at 8:20
answered Jan 4 at 10:27
Kévin AzoulayKévin Azoulay
64
64
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1387424%2fyarn-3-and-spark-allocate-a-gpu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown