|
16 | 16 | * Copyright (c) 2015 Intel, Inc. All rights reserved. |
17 | 17 | * Copyright (c) 2015 Research Organization for Information Science |
18 | 18 | * and Technology (RIST). All rights reserved. |
19 | | - * Copyright (c) 2016 IBM Corporation. All rights reserved. |
| 19 | + * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. |
20 | 20 | * $COPYRIGHT$ |
21 | 21 | * |
22 | 22 | * Additional copyrights may follow |
@@ -108,71 +108,16 @@ OBJ_CLASS_INSTANCE(ompi_java_buffer_t, |
108 | 108 | * Class: mpi_MPI |
109 | 109 | * Method: loadGlobalLibraries |
110 | 110 | * |
111 | | - * Java implementations typically default to loading dynamic |
112 | | - * libraries strictly to a local namespace. This breaks the |
113 | | - * Open MPI model where components reference back up to the |
114 | | - * base libraries (e.g., libmpi) as it requires that the |
115 | | - * symbols in those base libraries be globally available. |
116 | | - * |
117 | | - * One option, of course, is to build with --disable-dlopen. |
118 | | - * However, this would preclude the ability to pickup 3rd-party |
119 | | - * binary plug-ins at time of execution. This is a valuable |
120 | | - * capability that would be a negative factor towards use of |
121 | | - * the Java bindings. |
122 | | - * |
123 | | - * The other option is to explicitly dlopen libmpi ourselves |
124 | | - * and instruct dlopen to add all those symbols to the global |
125 | | - * namespace. This must be done prior to calling any MPI |
126 | | - * function (e.g., MPI_Init) or else Java will have already |
127 | | - * loaded the library to the local namespace. So create a |
128 | | - * special JNI entry point that just loads the required libmpi |
129 | | - * to the global namespace and call it first (see MPI.java), |
130 | | - * thus making all symbols available to subsequent dlopen calls |
131 | | - * when opening OMPI components. |
132 | 111 | */ |
133 | 112 | jint JNI_OnLoad(JavaVM *vm, void *reserved) |
134 | 113 | { |
135 | 114 | // Ensure that PSM signal hijacking is disabled *before* loading |
136 | 115 | // the library (see comment in the function for more detail). |
137 | 116 | opal_init_psm(); |
138 | 117 |
|
139 | | - libmpi = dlopen("lib" OMPI_LIBMPI_NAME "." OPAL_DYN_LIB_SUFFIX, RTLD_NOW | RTLD_GLOBAL); |
140 | | - |
141 | | -#if defined(HAVE_DL_INFO) && defined(HAVE_LIBGEN_H) |
142 | | - /* |
143 | | - * OS X El Capitan does not propagate DYLD_LIBRARY_PATH to children any more |
144 | | - * so if previous dlopen failed, try to open libmpi in the same directory |
145 | | - * than the current libmpi_java |
146 | | - */ |
147 | | - if(NULL == libmpi) { |
148 | | - Dl_info info; |
149 | | - if(0 != dladdr((void *)JNI_OnLoad, &info)) { |
150 | | - char libmpipath[OPAL_PATH_MAX]; |
151 | | - char *libmpijavapath = strdup(info.dli_fname); |
152 | | - if (NULL != libmpijavapath) { |
153 | | - snprintf(libmpipath, OPAL_PATH_MAX-1, "%s/lib" OMPI_LIBMPI_NAME "." OPAL_DYN_LIB_SUFFIX, dirname(libmpijavapath)); |
154 | | - free(libmpijavapath); |
155 | | - libmpi = dlopen(libmpipath, RTLD_NOW | RTLD_GLOBAL); |
156 | | - } |
157 | | - } |
158 | | - } |
159 | | -#endif |
160 | | - |
161 | | - if(NULL == libmpi) |
162 | | - { |
163 | | - fprintf(stderr, "Java bindings failed to load lib" OMPI_LIBMPI_NAME ": %s\n",dlerror()); |
164 | | - exit(1); |
165 | | - } |
166 | | - |
167 | 118 | return JNI_VERSION_1_6; |
168 | 119 | } |
169 | 120 |
|
170 | | -void JNI_OnUnload(JavaVM *vm, void *reserved) |
171 | | -{ |
172 | | - if(libmpi != NULL) |
173 | | - dlclose(libmpi); |
174 | | -} |
175 | | - |
176 | 121 | static void initFreeList(void) |
177 | 122 | { |
178 | 123 | OBJ_CONSTRUCT(&ompi_java_buffers, opal_free_list_t); |
|
0 commit comments