Skip to content

Commit f75a68f

Browse files
committed
Merge branches 'issue-524-team_number' and 'PIC-static-lib'
3 parents 926a2bb + 3ce1979 + e7a9bdf commit f75a68f

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ if(opencoarrays_aware_compiler)
719719
add_caf_test(comp_allocated_2 2 comp_allocated_2)
720720
add_caf_test(alloc_comp_get_convert_nums 2 alloc_comp_get_convert_nums)
721721
if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 8)
722-
add_caf_test(team_number 2 team_number)
722+
add_caf_test(team_number 8 team_number)
723723
add_caf_test(teams_subset 3 teams_subset)
724724
add_caf_test(get_communicator 3 get_communicator)
725725
add_caf_test(alloc_comp_multidim_shape 2 alloc_comp_multidim_shape)

prerequisites/install-functions/report_results.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ report_results()
6969
if [[ -d "${compiler_install_root%/}/lib" || -d "${compiler_install_root%/}/lib64" ]]; then
7070
echo "# Prepend the compiler library paths to the ${LD_LIB_P_VAR} environment variable:" | tee -a setup.sh setup.csh
7171
compiler_lib_paths="${compiler_install_root%/}/lib64/:${compiler_install_root%/}/lib"
72-
echo "if [[ -z \"\${!LD_LIB_P_VAR}\" ]]; then " >> setup.sh
72+
echo "if [[ -z \"\${!${LD_LIB_P_VAR}}\" ]]; then " >> setup.sh
7373
echo " export ${LD_LIB_P_VAR}=\"${compiler_lib_paths%/}\" " >> setup.sh
7474
echo "else " >> setup.sh
75-
echo " export ${LD_LIB_P_VAR}=\"${compiler_lib_paths%/}:\${!LD_LIB_P_VAR}\" " >> setup.sh
75+
echo " export ${LD_LIB_P_VAR}=\"${compiler_lib_paths%/}:\${!${LD_LIB_P_VAR}}\" " >> setup.sh
7676
echo "fi " >> setup.sh
7777
echo "setenv LD_LIBRARY_PATH \"${compiler_lib_paths%/}:\${LD_LIBRARY_PATH}\" " >> setup.csh
7878
fi

src/mpi/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ target_link_libraries(caf_mpi_static
3939
PUBLIC ${MPI_C_LINK_FLAGS}
4040
PUBLIC ${MPI_C_LIBRARIES}
4141
PRIVATE opencoarrays_mod)
42+
set_target_properties(caf_mpi_static
43+
PROPERTIES
44+
POSITION_INDEPENDENT_CODE TRUE)
4245
target_include_directories(caf_mpi
4346
PUBLIC $<$<COMPILE_LANGUAGE:C>:${MPI_C_INCLUDE_PATH}>)
4447
target_include_directories(caf_mpi_static

src/mpi/mpi_caf.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8152,12 +8152,10 @@ PREFIX(get_communicator) (caf_team_t *team)
81528152
int
81538153
PREFIX(team_number) (caf_team_t *team)
81548154
{
8155-
if (team != NULL) caf_runtime_error("team_number does not yet support "
8156-
"the optional team argument");
8157-
8158-
// if (used_teams->prev == NULL)
8159-
// return -1;
8160-
return used_teams->team_list_elem->team_id;
8155+
if (team != NULL)
8156+
return ((caf_teams_list *)team)->team_id;
8157+
else
8158+
return used_teams->team_list_elem->team_id; /* current team */
81618159
}
81628160

81638161
void PREFIX(end_team) (caf_team_t *team __attribute__((unused)))

src/tests/unit/teams/team-number.f90

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ program main
3737

3838
integer, parameter :: standard_initial_value=-1
3939

40-
type(team_type), target :: home
40+
type(team_type) :: parent, child
41+
42+
if (num_images() < 8) error stop "I need at least 8 images to function."
4143

4244
call assert(team_number()==standard_initial_value,"initial team number conforms with Fortran standard before 'change team'")
4345

@@ -47,11 +49,17 @@ program main
4749
!! TODO: uncomment the above assertion after implementing support for team_number's optional argument:
4850

4951
after_change_team: block
50-
associate(my_team=>mod(this_image(),2)+1)
52+
associate(parent_team_number => 100 + (num_images()-1)/4, child_team_number => 1000 + mod(num_images()-1,4)/2)
5153
!! Prepare for forming two teams: my_team = 1 for even image numbers in the initial team; 2 for odd image numbers
52-
form team(my_team,home)
53-
change team(home)
54-
call assert(team_number()==my_team,"team number conforms with Fortran standard after 'change team'")
54+
form team(parent_team_number,parent)
55+
change team(parent)
56+
call assert(team_number()==parent_team_number,"team number conforms with Fortran standard after 'change team'")
57+
form team (child_team_number, child)
58+
change team(child)
59+
call assert(team_number()==child_team_number,"team number conforms with Fortran standard after 'change team'")
60+
call assert(team_number(child)==child_team_number,"team_number(child) conforms with Fortran standard after 'change team'")
61+
call assert(team_number(parent)==parent_team_number,"team_number(parent) conforms with Fortran standard")
62+
end team
5563
end team
5664
call assert(team_number()==standard_initial_value,"initial team number conforms with Fortran standard")
5765
end associate

0 commit comments

Comments
 (0)