*====================================================================*/
* This software is delivered "as-is", with no warranties             */
* expressed or implied.  This software is not supported by IBM.      */
*====================================================================*/
* (C) COPYRIGHT International Business Machines Corp. 2001           */
* All Rights Reserved                                                */
*                                                                    */
* US Government Users Restricted Rights - Use, duplication or        */
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.  */
*====================================================================*/

      subroutine mybindthreads
      implicit none
      integer icpu(256),i1,loop

      i1 = num_parthds()

      print *,'rebind: num_parthds is ',i1
      open(15,file='rebind.inp')
      do 10 loop = 1,i1
         read(15,*) icpu(loop)
 10   continue
      close(15)


!$OMP PARALLEL DO
      do 20 loop = 1,i1
         call unbind_thread
 20   continue

!$OMP PARALLEL DO
      do 30 loop = 1,i1
         call bind_thread(icpu(loop))
 30   continue
      end
