Optimal CPI calculation confusion





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I am reading https://insidehpc.com/2017/07/cycles-per-instruction-matters/:




For example, if a certain part of the code takes 1200 cycles and
executes 600 instructions, then the CPI would be 1200/600 = 2.
However, a core in this case should have a CPI equal to 0.5, this
means that not enough work is being sent to the core, as only ¼ of the
capacity is being used.




Either I have missed something on this link (I can't see it if I have) or the calculation of 0.5 hasn't been justified. Can someone clarify please?










share|improve this question























  • Why don't you leave a comment for the author asking him to clarify?

    – DavidPostill
    Mar 7 at 12:00











  • I'm very, very sorry that I trust the people who use this site more than some random on the internet who could be writing complete nonsense. I came here as I have a great deal of respect for the users here because some of them are really, really smart. Moreover, my experience on other sites has been that authors simply don't respond to comments, let alone questions. I wanted an answer quickly, so came here. I guess in your book, whatever that is, that's a bad thing. How can a "moderator" have such a strange attitude towards someone coming here for help? I just don't get it. Sigh.

    – Wad
    Mar 7 at 12:17











  • My comment was just a suggestion. If someone here can answer the comment does not stop that.

    – DavidPostill
    Mar 7 at 12:19











  • I agree. However I am guessing it was you that downvoted; if not, then I do apologise. If it was, then maybe as a "moderator" you could also get a line of text added to the tooltip that appears over the downvote button stating "; or user has preferred to use a StackExchange site for clarification as opposed to using another resource".

    – Wad
    Mar 7 at 12:23











  • Nice idea, but that probably isn't going to happen. In any case, meta would be the correct place to make such a suggestion.

    – DavidPostill
    Mar 7 at 12:25


















0















I am reading https://insidehpc.com/2017/07/cycles-per-instruction-matters/:




For example, if a certain part of the code takes 1200 cycles and
executes 600 instructions, then the CPI would be 1200/600 = 2.
However, a core in this case should have a CPI equal to 0.5, this
means that not enough work is being sent to the core, as only ¼ of the
capacity is being used.




Either I have missed something on this link (I can't see it if I have) or the calculation of 0.5 hasn't been justified. Can someone clarify please?










share|improve this question























  • Why don't you leave a comment for the author asking him to clarify?

    – DavidPostill
    Mar 7 at 12:00











  • I'm very, very sorry that I trust the people who use this site more than some random on the internet who could be writing complete nonsense. I came here as I have a great deal of respect for the users here because some of them are really, really smart. Moreover, my experience on other sites has been that authors simply don't respond to comments, let alone questions. I wanted an answer quickly, so came here. I guess in your book, whatever that is, that's a bad thing. How can a "moderator" have such a strange attitude towards someone coming here for help? I just don't get it. Sigh.

    – Wad
    Mar 7 at 12:17











  • My comment was just a suggestion. If someone here can answer the comment does not stop that.

    – DavidPostill
    Mar 7 at 12:19











  • I agree. However I am guessing it was you that downvoted; if not, then I do apologise. If it was, then maybe as a "moderator" you could also get a line of text added to the tooltip that appears over the downvote button stating "; or user has preferred to use a StackExchange site for clarification as opposed to using another resource".

    – Wad
    Mar 7 at 12:23











  • Nice idea, but that probably isn't going to happen. In any case, meta would be the correct place to make such a suggestion.

    – DavidPostill
    Mar 7 at 12:25














0












0








0








I am reading https://insidehpc.com/2017/07/cycles-per-instruction-matters/:




For example, if a certain part of the code takes 1200 cycles and
executes 600 instructions, then the CPI would be 1200/600 = 2.
However, a core in this case should have a CPI equal to 0.5, this
means that not enough work is being sent to the core, as only ¼ of the
capacity is being used.




Either I have missed something on this link (I can't see it if I have) or the calculation of 0.5 hasn't been justified. Can someone clarify please?










share|improve this question














I am reading https://insidehpc.com/2017/07/cycles-per-instruction-matters/:




For example, if a certain part of the code takes 1200 cycles and
executes 600 instructions, then the CPI would be 1200/600 = 2.
However, a core in this case should have a CPI equal to 0.5, this
means that not enough work is being sent to the core, as only ¼ of the
capacity is being used.




Either I have missed something on this link (I can't see it if I have) or the calculation of 0.5 hasn't been justified. Can someone clarify please?







cpu cpu-architecture






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 11:53









WadWad

1216




1216













  • Why don't you leave a comment for the author asking him to clarify?

    – DavidPostill
    Mar 7 at 12:00











  • I'm very, very sorry that I trust the people who use this site more than some random on the internet who could be writing complete nonsense. I came here as I have a great deal of respect for the users here because some of them are really, really smart. Moreover, my experience on other sites has been that authors simply don't respond to comments, let alone questions. I wanted an answer quickly, so came here. I guess in your book, whatever that is, that's a bad thing. How can a "moderator" have such a strange attitude towards someone coming here for help? I just don't get it. Sigh.

    – Wad
    Mar 7 at 12:17











  • My comment was just a suggestion. If someone here can answer the comment does not stop that.

    – DavidPostill
    Mar 7 at 12:19











  • I agree. However I am guessing it was you that downvoted; if not, then I do apologise. If it was, then maybe as a "moderator" you could also get a line of text added to the tooltip that appears over the downvote button stating "; or user has preferred to use a StackExchange site for clarification as opposed to using another resource".

    – Wad
    Mar 7 at 12:23











  • Nice idea, but that probably isn't going to happen. In any case, meta would be the correct place to make such a suggestion.

    – DavidPostill
    Mar 7 at 12:25



















  • Why don't you leave a comment for the author asking him to clarify?

    – DavidPostill
    Mar 7 at 12:00











  • I'm very, very sorry that I trust the people who use this site more than some random on the internet who could be writing complete nonsense. I came here as I have a great deal of respect for the users here because some of them are really, really smart. Moreover, my experience on other sites has been that authors simply don't respond to comments, let alone questions. I wanted an answer quickly, so came here. I guess in your book, whatever that is, that's a bad thing. How can a "moderator" have such a strange attitude towards someone coming here for help? I just don't get it. Sigh.

    – Wad
    Mar 7 at 12:17











  • My comment was just a suggestion. If someone here can answer the comment does not stop that.

    – DavidPostill
    Mar 7 at 12:19











  • I agree. However I am guessing it was you that downvoted; if not, then I do apologise. If it was, then maybe as a "moderator" you could also get a line of text added to the tooltip that appears over the downvote button stating "; or user has preferred to use a StackExchange site for clarification as opposed to using another resource".

    – Wad
    Mar 7 at 12:23











  • Nice idea, but that probably isn't going to happen. In any case, meta would be the correct place to make such a suggestion.

    – DavidPostill
    Mar 7 at 12:25

















Why don't you leave a comment for the author asking him to clarify?

– DavidPostill
Mar 7 at 12:00





Why don't you leave a comment for the author asking him to clarify?

– DavidPostill
Mar 7 at 12:00













I'm very, very sorry that I trust the people who use this site more than some random on the internet who could be writing complete nonsense. I came here as I have a great deal of respect for the users here because some of them are really, really smart. Moreover, my experience on other sites has been that authors simply don't respond to comments, let alone questions. I wanted an answer quickly, so came here. I guess in your book, whatever that is, that's a bad thing. How can a "moderator" have such a strange attitude towards someone coming here for help? I just don't get it. Sigh.

– Wad
Mar 7 at 12:17





I'm very, very sorry that I trust the people who use this site more than some random on the internet who could be writing complete nonsense. I came here as I have a great deal of respect for the users here because some of them are really, really smart. Moreover, my experience on other sites has been that authors simply don't respond to comments, let alone questions. I wanted an answer quickly, so came here. I guess in your book, whatever that is, that's a bad thing. How can a "moderator" have such a strange attitude towards someone coming here for help? I just don't get it. Sigh.

– Wad
Mar 7 at 12:17













My comment was just a suggestion. If someone here can answer the comment does not stop that.

– DavidPostill
Mar 7 at 12:19





My comment was just a suggestion. If someone here can answer the comment does not stop that.

– DavidPostill
Mar 7 at 12:19













I agree. However I am guessing it was you that downvoted; if not, then I do apologise. If it was, then maybe as a "moderator" you could also get a line of text added to the tooltip that appears over the downvote button stating "; or user has preferred to use a StackExchange site for clarification as opposed to using another resource".

– Wad
Mar 7 at 12:23





I agree. However I am guessing it was you that downvoted; if not, then I do apologise. If it was, then maybe as a "moderator" you could also get a line of text added to the tooltip that appears over the downvote button stating "; or user has preferred to use a StackExchange site for clarification as opposed to using another resource".

– Wad
Mar 7 at 12:23













Nice idea, but that probably isn't going to happen. In any case, meta would be the correct place to make such a suggestion.

– DavidPostill
Mar 7 at 12:25





Nice idea, but that probably isn't going to happen. In any case, meta would be the correct place to make such a suggestion.

– DavidPostill
Mar 7 at 12:25










1 Answer
1






active

oldest

votes


















1














The actual article is unclear, but the clarifying phrases are both earlier and later.



In the sentence before your quote




For the per core case, all of the threads running on a hardware core must be aggregated to arrive at the proper ratio. 




And after




On an Intel Xeon Phi processor, there are 72 cores that can each have 4 threads running simultaneously




So for a CPI you need to know the Cycles (1200), number of instructions (600). Then if you want to know if you are using all of the CPU threads available and therefore theoretically fully burdening the core you need to know the number of thread per core (4).



The CPI figure is 2, but the author is then (without explaining it) dividing by the number of threads on each core. This gives you 2/4 = 0.5.



What the 0.5 figure is not CPI, but is some other figure that relates your (known) CPI to the number of threads. The actual value of this metric is only really useful when you have a good idea of ratio of how long your instructions take (their CPI) and how multi threaded your application is. If you are running the same thread doing a lot of calculations you can optimise the number of threads you run on a core or core set.



As a result you can tell that any number below 2 (for this particular code) is not using all the threads available and therefore the core could be given more work. Any number over 2 indicates that the core has more work than it can handle and task switching penalties will occur.



This is where I believe he is getting his 0.5 figure from.



The article is actually quite badly written but is trying to emphasise that you need to optimise your multi threading with knowledge of both how instructions execute, which is the CPI (2), and how many threads or cores you have available to effectively load up the resources appropriately.






share|improve this answer


























  • Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

    – Wad
    Mar 7 at 12:51











  • @Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

    – Mokubai
    Mar 7 at 13:00











  • Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

    – Wad
    Mar 7 at 13:48












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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1412094%2foptimal-cpi-calculation-confusion%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









1














The actual article is unclear, but the clarifying phrases are both earlier and later.



In the sentence before your quote




For the per core case, all of the threads running on a hardware core must be aggregated to arrive at the proper ratio. 




And after




On an Intel Xeon Phi processor, there are 72 cores that can each have 4 threads running simultaneously




So for a CPI you need to know the Cycles (1200), number of instructions (600). Then if you want to know if you are using all of the CPU threads available and therefore theoretically fully burdening the core you need to know the number of thread per core (4).



The CPI figure is 2, but the author is then (without explaining it) dividing by the number of threads on each core. This gives you 2/4 = 0.5.



What the 0.5 figure is not CPI, but is some other figure that relates your (known) CPI to the number of threads. The actual value of this metric is only really useful when you have a good idea of ratio of how long your instructions take (their CPI) and how multi threaded your application is. If you are running the same thread doing a lot of calculations you can optimise the number of threads you run on a core or core set.



As a result you can tell that any number below 2 (for this particular code) is not using all the threads available and therefore the core could be given more work. Any number over 2 indicates that the core has more work than it can handle and task switching penalties will occur.



This is where I believe he is getting his 0.5 figure from.



The article is actually quite badly written but is trying to emphasise that you need to optimise your multi threading with knowledge of both how instructions execute, which is the CPI (2), and how many threads or cores you have available to effectively load up the resources appropriately.






share|improve this answer


























  • Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

    – Wad
    Mar 7 at 12:51











  • @Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

    – Mokubai
    Mar 7 at 13:00











  • Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

    – Wad
    Mar 7 at 13:48
















1














The actual article is unclear, but the clarifying phrases are both earlier and later.



In the sentence before your quote




For the per core case, all of the threads running on a hardware core must be aggregated to arrive at the proper ratio. 




And after




On an Intel Xeon Phi processor, there are 72 cores that can each have 4 threads running simultaneously




So for a CPI you need to know the Cycles (1200), number of instructions (600). Then if you want to know if you are using all of the CPU threads available and therefore theoretically fully burdening the core you need to know the number of thread per core (4).



The CPI figure is 2, but the author is then (without explaining it) dividing by the number of threads on each core. This gives you 2/4 = 0.5.



What the 0.5 figure is not CPI, but is some other figure that relates your (known) CPI to the number of threads. The actual value of this metric is only really useful when you have a good idea of ratio of how long your instructions take (their CPI) and how multi threaded your application is. If you are running the same thread doing a lot of calculations you can optimise the number of threads you run on a core or core set.



As a result you can tell that any number below 2 (for this particular code) is not using all the threads available and therefore the core could be given more work. Any number over 2 indicates that the core has more work than it can handle and task switching penalties will occur.



This is where I believe he is getting his 0.5 figure from.



The article is actually quite badly written but is trying to emphasise that you need to optimise your multi threading with knowledge of both how instructions execute, which is the CPI (2), and how many threads or cores you have available to effectively load up the resources appropriately.






share|improve this answer


























  • Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

    – Wad
    Mar 7 at 12:51











  • @Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

    – Mokubai
    Mar 7 at 13:00











  • Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

    – Wad
    Mar 7 at 13:48














1












1








1







The actual article is unclear, but the clarifying phrases are both earlier and later.



In the sentence before your quote




For the per core case, all of the threads running on a hardware core must be aggregated to arrive at the proper ratio. 




And after




On an Intel Xeon Phi processor, there are 72 cores that can each have 4 threads running simultaneously




So for a CPI you need to know the Cycles (1200), number of instructions (600). Then if you want to know if you are using all of the CPU threads available and therefore theoretically fully burdening the core you need to know the number of thread per core (4).



The CPI figure is 2, but the author is then (without explaining it) dividing by the number of threads on each core. This gives you 2/4 = 0.5.



What the 0.5 figure is not CPI, but is some other figure that relates your (known) CPI to the number of threads. The actual value of this metric is only really useful when you have a good idea of ratio of how long your instructions take (their CPI) and how multi threaded your application is. If you are running the same thread doing a lot of calculations you can optimise the number of threads you run on a core or core set.



As a result you can tell that any number below 2 (for this particular code) is not using all the threads available and therefore the core could be given more work. Any number over 2 indicates that the core has more work than it can handle and task switching penalties will occur.



This is where I believe he is getting his 0.5 figure from.



The article is actually quite badly written but is trying to emphasise that you need to optimise your multi threading with knowledge of both how instructions execute, which is the CPI (2), and how many threads or cores you have available to effectively load up the resources appropriately.






share|improve this answer















The actual article is unclear, but the clarifying phrases are both earlier and later.



In the sentence before your quote




For the per core case, all of the threads running on a hardware core must be aggregated to arrive at the proper ratio. 




And after




On an Intel Xeon Phi processor, there are 72 cores that can each have 4 threads running simultaneously




So for a CPI you need to know the Cycles (1200), number of instructions (600). Then if you want to know if you are using all of the CPU threads available and therefore theoretically fully burdening the core you need to know the number of thread per core (4).



The CPI figure is 2, but the author is then (without explaining it) dividing by the number of threads on each core. This gives you 2/4 = 0.5.



What the 0.5 figure is not CPI, but is some other figure that relates your (known) CPI to the number of threads. The actual value of this metric is only really useful when you have a good idea of ratio of how long your instructions take (their CPI) and how multi threaded your application is. If you are running the same thread doing a lot of calculations you can optimise the number of threads you run on a core or core set.



As a result you can tell that any number below 2 (for this particular code) is not using all the threads available and therefore the core could be given more work. Any number over 2 indicates that the core has more work than it can handle and task switching penalties will occur.



This is where I believe he is getting his 0.5 figure from.



The article is actually quite badly written but is trying to emphasise that you need to optimise your multi threading with knowledge of both how instructions execute, which is the CPI (2), and how many threads or cores you have available to effectively load up the resources appropriately.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 13:13

























answered Mar 7 at 12:28









MokubaiMokubai

58.2k16139157




58.2k16139157













  • Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

    – Wad
    Mar 7 at 12:51











  • @Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

    – Mokubai
    Mar 7 at 13:00











  • Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

    – Wad
    Mar 7 at 13:48



















  • Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

    – Wad
    Mar 7 at 12:51











  • @Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

    – Mokubai
    Mar 7 at 13:00











  • Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

    – Wad
    Mar 7 at 13:48

















Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

– Wad
Mar 7 at 12:51





Thanks for taking the time to respond positively!. I'm sorry, I still don't get it. Author says CPI=2 is not good as we can add more work, thus we want CPI=0.5. But you say CPI < 1 means more work can be added, and CPI > 1 means too busy? I also still don't get what calculation has been done to get 0.5 (again, sorry!). Can you please clarify?

– Wad
Mar 7 at 12:51













@Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

– Mokubai
Mar 7 at 13:00





@Wad the calculation is to divide the CPI by the number of Core threads, so 2/4 which equals 0.5. That then effectively gives you the "thread saturation" of the core. I'll edit.

– Mokubai
Mar 7 at 13:00













Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

– Wad
Mar 7 at 13:48





Confusing article. Thanks for doing your best to clarify what is evidently a bit of a wreck (?)

– Wad
Mar 7 at 13:48


















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1412094%2foptimal-cpi-calculation-confusion%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Probability when a professor distributes a quiz and homework assignment to a class of n students.

Aardman Animations

Are they similar matrix