Only rebuild Aten library

Dizzy_Hint: <p>Hi all,</p>
<p>I am trying to adjust the C++ code in Aten library(pytorch/aten/src/ATen/native), but it is not practical to run CMake every time.</p>
<p>I found this post, but the make option(build_caffe2) does not work anymore.</p><aside class="onebox githubissue" data-onebox-src="https://github.com/pytorch/pytorch/issues/7370">
  <header class="source">

      <a href="https://github.com/pytorch/pytorch/issues/7370" target="_blank" rel="noopener nofollow ugc">github.com/pytorch/pytorch</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewbox="0 0 14 16" aria-hidden="true"><path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/pytorch/pytorch/issues/7370" target="_blank" rel="noopener nofollow ugc">Rebuilding Pytorch after modifying C++ code in aten library</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2018-05-08" data-time="11:35:41" data-timezone="UTC">11:35AM - 08 May 18 UTC</span>
      </div>

        <div class="date">
          closed <span class="discourse-local-date" data-format="ll" data-date="2018-05-08" data-time="11:59:17" data-timezone="UTC">11:59AM - 08 May 18 UTC</span>
        </div>

      <div class="user">
        <a href="https://github.com/knandanan" target="_blank" rel="noopener nofollow ugc">
          <img alt="knandanan" src="https://avatars.githubusercontent.com/u/30831317?v=4" class="onebox-avatar-inline" width="20" height="20">
          knandanan
        </a>
      </div>
    </div>

    <div class="labels">
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">Would python setup.py build be enough to rebuild the pytorch after changing C++/<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">Cuda code in the aten library ? For example  I would like to modify the forward and back propagation for batch normalization and I intend to make changes in BatchNormalization.cu in THC library . How would I go about rebuilding the code. I apologise in advance if the question is really trivial as I am a beginner to PyTorch :)</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>So is there an easy way to adjust and test the C++ files in Aten?</p>

ptrblck: <p>I usually just use <code>python setup.py develop</code> which will trigger a full rebuild the first time, but will only rebuild the changed (and affected) files afterwards.</p>

Dizzy_Hint: <p>Thank you for your reply!</p>
<p>In my case, “python setup.py install” also do the same thing. It only compiled the files I modified after the first build. I am impressed how smart the building script is.</p>

ptrblck: <p>I think adding <code>ccache</code> and <code>ninja</code> can additionally speed up the build (unsure as I have them installed by default so haven’t compared the build without them in a while).</p>

Dizzy_Hint: <p>In my case, my script used ninja to do all the jobs without any additional option. I noticed that ninja is a prerequisite in the <a href="https://github.com/pytorch/pytorch#from-source" rel="noopener nofollow ugc">tutorial</a>. Maybe it is the default building tool if ppl follow the tutorial.</p>