atomes 1.1.14
atomes: an atomic scale modeling tool box
Loading...
Searching...
No Matches
threads.F90
Go to the documentation of this file.
1! This file is part of the 'atomes' software.
2!
3! 'atomes' is free software: you can redistribute it and/or modify it under the terms
4! of the GNU Affero General Public License as published by the Free Software Foundation,
5! either version 3 of the License, or (at your option) any later version.
6!
7! 'atomes' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
8! without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9! See the GNU General Public License for more details.
10!
11! You should have received a copy of the GNU Affero General Public License along with 'atomes'.
12! If not, see <https://www.gnu.org/licenses/>
13!
14! Copyright (C) 2022-2024 by CNRS and University of Strasbourg
15!
20
21INTEGER FUNCTION get_thread_start (NOBJ, NTHREADS, THREAD_ID)
22
23 IMPLICIT NONE
24
25 INTEGER, INTENT(IN) :: nobj, nthreads, thread_id
26 INTEGER :: tmp
27 REAL :: va, vb
28
29 va = nobj
30 vb = nthreads
31 tmp = int(va/vb)
32 get_thread_start = tmp * thread_id + 1
33
34END FUNCTION
35
36INTEGER FUNCTION get_thread_end (NOBJ, NTHREADS, THREAD_ID)
37
38 IMPLICIT NONE
39
40 INTEGER, INTENT(IN) :: nobj, nthreads, thread_id
41 INTEGER :: tmp
42 REAL :: va, vb
43
44 va = nobj
45 vb = nthreads
46 tmp = int(va/vb)
47 if (thread_id .eq. nthreads-1) then
48 get_thread_end = nobj
49 else
50 get_thread_end = tmp * (thread_id+1)
51 endif
52
53END FUNCTION
integer function get_thread_start(nobj, nthreads, thread_id)
Definition threads.F90:22
integer function get_thread_end(nobj, nthreads, thread_id)
Definition threads.F90:37