Skip to content

Commit

Permalink
fix fortran due to the change of C API
Browse files Browse the repository at this point in the history
  • Loading branch information
eddy16112 committed Oct 5, 2018
1 parent def6146 commit 827e3ef
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 32 deletions.
4 changes: 3 additions & 1 deletion runtime/legion/legion_f_c_interface.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function legion_task_layout_constraint_set_create_f() &

! Legion::Runtime::preregister_task_variant()
function legion_runtime_preregister_task_variant_fnptr_f(id, task_name, &
variant_name, &
execution_constraints, &
layout_constraints, &
options, &
Expand All @@ -64,6 +65,7 @@ function legion_runtime_preregister_task_variant_fnptr_f(id, task_name, &

integer(c_int) :: legion_runtime_preregister_task_variant_fnptr_f
character(kind=c_char), intent(in) :: task_name(*)
character(kind=c_char), intent(in) :: variant_name(*)
integer(c_int), value, intent(in) :: id
type(legion_execution_constraint_set_f_t), value, intent(in) :: execution_constraints
type(legion_task_layout_constraint_set_f_t), value, intent(in) :: layout_constraints
Expand Down Expand Up @@ -1224,4 +1226,4 @@ subroutine legion_convert_1d_to_2d_column_major_c(src, dst, offset, num_columns)
integer(c_int), value, intent(in) :: num_columns
end subroutine
end interface
end module
end module
2 changes: 1 addition & 1 deletion tutorial-c/00_hello_world/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GEN_GPU_SRC ?= # .cu files

# You can modify these variables, some will be appended to by the runtime makefile
INC_FLAGS ?=
CC_FLAGS ?=
CC_FLAGS ?= -I/$(LG_RT_DIR)/legion
NVCC_FLAGS ?=
GASNET_FLAGS ?=
LD_FLAGS ?=
Expand Down
6 changes: 4 additions & 2 deletions tutorial-c/00_hello_world/hello_world.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum TaskID {
};

void hello_world_task(const void *data, size_t datalen,
const void *userdata, size_t userlen, legion_lowlevel_id_t p)
const void *userdata, size_t userlen, realm_id_t p)
{
// assert(task->arglen == sizeof(int));
// int rank = *(const int*)task->args;
Expand All @@ -52,7 +52,7 @@ void hello_world_task(const void *data, size_t datalen,


void top_level_task(const void *data, size_t datalen,
const void *userdata, size_t userlen, legion_lowlevel_id_t p)
const void *userdata, size_t userlen, realm_id_t p)
{
legion_task_t task;
const legion_physical_region_t *regions;
Expand Down Expand Up @@ -116,6 +116,7 @@ int main(int argc, char **argv)
legion_task_config_options_t config_options = {.leaf = false, .inner = false, .idempotent = false};
legion_runtime_preregister_task_variant_fnptr(TOP_LEVEL_TASK_ID,
"top_leve_task",
"cpu_variant",
execution_constraints,
layout_constraints,
config_options,
Expand All @@ -125,6 +126,7 @@ int main(int argc, char **argv)

legion_runtime_preregister_task_variant_fnptr(HELLO_WORLD_TASK_ID,
"hello_world_task",
"cpu_variant",
execution_constraints,
layout_constraints,
config_options,
Expand Down
2 changes: 1 addition & 1 deletion tutorial-c/02_index_tasks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GEN_GPU_SRC ?= # .cu files

# You can modify these variables, some will be appended to by the runtime makefile
INC_FLAGS ?=
CC_FLAGS ?=
CC_FLAGS ?= -I/$(LG_RT_DIR)/legion
NVCC_FLAGS ?=
GASNET_FLAGS ?=
LD_FLAGS ?=
Expand Down
6 changes: 4 additions & 2 deletions tutorial-c/02_index_tasks/index_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enum TaskID {
};

void hello_world_task(const void *data, size_t datalen,
const void *userdata, size_t userlen, legion_lowlevel_id_t p)
const void *userdata, size_t userlen, realm_id_t p)
{
// assert(task->arglen == sizeof(int));
// int rank = *(const int*)task->args;
Expand All @@ -55,7 +55,7 @@ void hello_world_task(const void *data, size_t datalen,


void top_level_task(const void *data, size_t datalen,
const void *userdata, size_t userlen, legion_lowlevel_id_t p)
const void *userdata, size_t userlen, realm_id_t p)
{
legion_task_t task;
const legion_physical_region_t *regions;
Expand Down Expand Up @@ -126,6 +126,7 @@ int main(int argc, char **argv)
legion_task_config_options_t config_options = {.leaf = false, .inner = false, .idempotent = false};
legion_runtime_preregister_task_variant_fnptr(TOP_LEVEL_TASK_ID,
"top_leve_task",
"cpu_variant",
execution_constraints,
layout_constraints,
config_options,
Expand All @@ -135,6 +136,7 @@ int main(int argc, char **argv)

legion_runtime_preregister_task_variant_fnptr(HELLO_WORLD_TASK_ID,
"hello_world_task",
"cpu_variant",
execution_constraints,
layout_constraints,
config_options,
Expand Down
9 changes: 6 additions & 3 deletions tutorial-fortran/c_with_fortran/06_privileges/privileges.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,12 @@ void daxpy_task(const Task *task,
LogicalRegion lr = regions[0].get_logical_region();
IndexSpace id = lr.get_index_space();
Rect<1> rect = runtime->get_index_space_domain(ctx, id);
const FieldAccessor<READ_ONLY,double,1> acc_x(regions[0], FID_X);
const FieldAccessor<READ_ONLY,double,1> acc_y(regions[0], FID_Y);
const FieldAccessor<WRITE_DISCARD,double,1> acc_z(regions[1], FID_Z);
const FieldAccessor<READ_ONLY,double,1,coord_t,
Realm::AffineAccessor<double,1,coord_t> > acc_x(regions[0], FID_X);
const FieldAccessor<READ_ONLY,double,1,coord_t,
Realm::AffineAccessor<double,1,coord_t> > acc_y(regions[0], FID_Y);
const FieldAccessor<WRITE_DISCARD,double,1,coord_t,
Realm::AffineAccessor<double,1,coord_t> > acc_z(regions[1], FID_Z);

// Get dense pointers for use with thrust

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ GEN_FORTRAN_SRC ?= daxpy_task_f.f90

# You can modify these variables, some will be appended to by the runtime makefile
INC_FLAGS ?=
CC_FLAGS ?=
CC_FLAGS ?= -I/$(LG_RT_DIR)/legion
NVCC_FLAGS ?=
GASNET_FLAGS ?=
LD_FLAGS ?=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum FieldIDs {

#ifdef __cplusplus
extern "C" {
void daxpy_task_f(const void *data, size_t datalen, const void *userdata, size_t userlen, legion_lowlevel_id_t p);
void daxpy_task_f(const void *data, size_t datalen, const void *userdata, size_t userlen, realm_id_t p);
}
#endif

Expand Down Expand Up @@ -257,7 +257,7 @@ void init_field_task(const Task *task,



void daxpy_task(const void *data, size_t datalen, const void *userdata, size_t userlen, legion_lowlevel_id_t p)
void daxpy_task(const void *data, size_t datalen, const void *userdata, size_t userlen, realm_id_t p)
{
printf("daxpy task C\n");
daxpy_task_f(data, datalen, userdata, userlen, p);
Expand Down Expand Up @@ -320,6 +320,7 @@ int main(int argc, char **argv)
legion_task_config_options_t config_options = {.leaf = false, .inner = false, .idempotent = false};
legion_runtime_preregister_task_variant_fnptr(DAXPY_TASK_ID,
"daxpy",
"cpu_variant",
execution_constraints,
layout_constraints,
config_options,
Expand All @@ -335,4 +336,4 @@ int main(int argc, char **argv)
}

return Runtime::start(argc, argv);
}
}
4 changes: 3 additions & 1 deletion tutorial-fortran/fortran/00_hello_world/hello_world.f90
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Program Hello
c_func_ptr = c_funloc(top_level_task)

task_id_1 = legion_runtime_preregister_task_variant_fnptr_f(TOP_LEVEL_TASK_ID, c_char_"top_level_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -127,6 +128,7 @@ Program Hello
c_func_ptr = c_funloc(hello_world_task)

task_id_2 = legion_runtime_preregister_task_variant_fnptr_f(HELLO_WORLD_TASK_ID, c_char_"hello_world_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -135,4 +137,4 @@ Program Hello
userlen)

runtime_start_rv = legion_runtime_start_f(0, c_null_ptr, background)
End Program Hello
End Program Hello
2 changes: 1 addition & 1 deletion tutorial-fortran/fortran/02_index_tasks/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DEBUG ?= 1 # Include debugging symbols
OUTPUT_LEVEL ?= LEVEL_DEBUG # Compile time logging level
USE_CUDA ?= 0 # Include CUDA support (requires CUDA)
USE_GASNET ?= 0 # Include GASNet support (requires GASNet)
USE_HDF ?= 1 # Include HDF5 support (requires HDF5)
USE_HDF ?= 0 # Include HDF5 support (requires HDF5)
ALT_MAPPERS ?= 0 # Include alternative mappers (not recommended)

# Put the binary file name here
Expand Down
6 changes: 4 additions & 2 deletions tutorial-fortran/fortran/02_index_tasks/index_tasks.f90
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function top_level_task(tdata, tdatalen, userdata, userlen, p)
local_task_args(i)%args = c_loc(input)
local_task_args(i)%arglen = c_sizeof(input)
tmp_p%x(0) = i
dp = legion_domain_point_from_point_1d_f(tmp_p)
call legion_domain_point_from_point_1d_f(tmp_p, dp)
call legion_argument_map_set_point_f(arg_map, dp, local_task_args(i), replace)
end do

Expand Down Expand Up @@ -151,6 +151,7 @@ Program Hello
c_func_ptr = c_funloc(top_level_task)

task_id_1 = legion_runtime_preregister_task_variant_fnptr_f(TOP_LEVEL_TASK_ID, c_char_"top_level_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -161,6 +162,7 @@ Program Hello
c_func_ptr = c_funloc(hello_world_task)

task_id_2 = legion_runtime_preregister_task_variant_fnptr_f(HELLO_WORLD_TASK_ID, c_char_"hello_world_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -169,4 +171,4 @@ Program Hello
userlen)

runtime_start_rv = legion_runtime_start_f(0, c_null_ptr, background)
End Program Hello
End Program Hello
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ Program Hello
type(legion_task_config_options_f_t) :: config_options
integer(c_int) :: proc_kind = 2
integer(c_int) :: TOP_LEVEL_TASK_ID, INIT_TASK_ID, DAXPY_TASK_ID, CHECK_TASK_ID
integer(c_int) :: task_id_1, task_id_2, task_id_3
integer(c_int) :: task_id_1, task_id_2, task_id_3, task_id_4
integer(c_size_t) :: userlen = 0
integer(c_int) :: runtime_start_rv
logical(c_bool) :: background = .FALSE.
Expand Down Expand Up @@ -410,6 +410,7 @@ Program Hello
c_func_ptr = c_funloc(top_level_task)

task_id_1 = legion_runtime_preregister_task_variant_fnptr_f(TOP_LEVEL_TASK_ID, c_char_"top_level_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -420,6 +421,7 @@ Program Hello
c_func_ptr = c_funloc(init_task)

task_id_2 = legion_runtime_preregister_task_variant_fnptr_f(INIT_TASK_ID, c_char_"init_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -430,6 +432,7 @@ Program Hello
c_func_ptr = c_funloc(daxpy_task)

task_id_3 = legion_runtime_preregister_task_variant_fnptr_f(DAXPY_TASK_ID, c_char_"daxpy_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -439,12 +442,13 @@ Program Hello

c_func_ptr = c_funloc(check_task)

task_id_3 = legion_runtime_preregister_task_variant_fnptr_f(CHECK_TASK_ID, c_char_"check_task"//c_null_char, &
task_id_4 = legion_runtime_preregister_task_variant_fnptr_f(CHECK_TASK_ID, c_char_"check_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
c_func_ptr, &
c_null_ptr, &
userlen)
runtime_start_rv = legion_runtime_start_f(0, c_null_ptr, background)
End Program Hello
End Program Hello
10 changes: 7 additions & 3 deletions tutorial-fortran/fortran/06_privileges_accessor/privileges.f90
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ Program Hello
type(legion_task_config_options_f_t) :: config_options
integer(c_int) :: proc_kind = 2
integer(c_int) :: TOP_LEVEL_TASK_ID, INIT_TASK_ID, DAXPY_TASK_ID, CHECK_TASK_ID
integer(c_int) :: task_id_1, task_id_2, task_id_3
integer(c_int) :: task_id_1, task_id_2, task_id_3, task_id_4
integer(c_size_t) :: userlen = 0
integer(c_int) :: runtime_start_rv
logical(c_bool) :: background = .FALSE.
Expand Down Expand Up @@ -384,6 +384,7 @@ Program Hello
c_func_ptr = c_funloc(top_level_task)

task_id_1 = legion_runtime_preregister_task_variant_fnptr_f(TOP_LEVEL_TASK_ID, c_char_"top_level_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -394,6 +395,7 @@ Program Hello
c_func_ptr = c_funloc(init_task)

task_id_2 = legion_runtime_preregister_task_variant_fnptr_f(INIT_TASK_ID, c_char_"init_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -404,6 +406,7 @@ Program Hello
c_func_ptr = c_funloc(daxpy_task)

task_id_3 = legion_runtime_preregister_task_variant_fnptr_f(DAXPY_TASK_ID, c_char_"daxpy_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
Expand All @@ -413,12 +416,13 @@ Program Hello

c_func_ptr = c_funloc(check_task)

task_id_3 = legion_runtime_preregister_task_variant_fnptr_f(CHECK_TASK_ID, c_char_"check_task"//c_null_char, &
task_id_4 = legion_runtime_preregister_task_variant_fnptr_f(CHECK_TASK_ID, c_char_"check_task"//c_null_char, &
c_char_"cpu_variant"//c_null_char, &
execution_constraints, &
layout_constraints, &
config_options, &
c_func_ptr, &
c_null_ptr, &
userlen)
runtime_start_rv = legion_runtime_start_f(0, c_null_ptr, background)
End Program Hello
End Program Hello
Loading

0 comments on commit 827e3ef

Please sign in to comment.