Linking time errors

Q1.

I’m using three subroutines(and functions): hostnm, getlog, changedirqq.

All of those does not give any errors at compile time,

but give ‘unresolved external symbol’ errors at linking time.

How should I solve this problem?

Q2.

I’m porting from MPICH2 to Microsoft MPI.

I installed Microsoft HPC 2012 Pack and SDK, MS-MPI v7 and SDK and excluded MPICH2 from my project.

Now the compiler gives whole bunch of errors at linking time:

45 unresolved external symbol _MPI_BCAST@28 referenced in function _MPICOMM_MOD_GETMPIFILE@16 MPIComm_mod.obj
205 unresolved external symbol _mpi_dist_graph_create@56 msmpifms.lib
204 unresolved external symbol MPI_DIST_GRAPH_CREATE@56 msmpifms.lib
197 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
198 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
199 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
200 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
201 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
202 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
203 unresolved external symbol mpi_dist_graph_create@56 msmpifms.lib
206 unresolved external symbol mpi_dist_graph_create
@56 msmpifms.lib
191 unresolved external symbol _mpi_dist_graph_create_adjacent@60 msmpifms.lib
190 unresolved external symbol MPI_DIST_GRAPH_CREATE_ADJACENT@60 msmpifms.lib
183 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
184 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
185 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
186 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
187 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
188 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
189 unresolved external symbol mpi_dist_graph_create_adjacent@60 msmpifms.lib
192 unresolved external symbol mpi_dist_graph_create_adjacent
@60 msmpifms.lib
177 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
176 unresolved external symbol MPI_DIST_GRAPH_NEIGHBORS@44 msmpifms.lib
169 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
170 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
171 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
172 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
173 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
174 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
175 unresolved external symbol mpi_dist_graph_neighbors@44 msmpifms.lib
164 unresolved external symbol mpi_dist_graph_neighbors
@28 msmpifms.lib
178 unresolved external symbol mpi_dist_graph_neighbors
@44 msmpifms.lib
163 unresolved external symbol _mpi_dist_graph_neighbors_count@28 msmpifms.lib
162 unresolved external symbol _MPI_DIST_GRAPH_NEIGHBORS_COUNT@28 msmpifms.lib
155 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
156 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
157 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
158 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
159 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
160 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
161 unresolved external symbol mpi_dist_graph_neighbors_count@28 msmpifms.lib
135 unresolved external symbol _mpi_get_elements_x@20 msmpifms.lib
134 unresolved external symbol MPI_GET_ELEMENTS_X@20 msmpifms.lib
127 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
128 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
129 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
130 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
131 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
132 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
133 unresolved external symbol mpi_get_elements_x@20 msmpifms.lib
136 unresolved external symbol mpi_get_elements_x
@20 msmpifms.lib
65 unresolved external symbol _mpi_improbe@20 msmpifms.lib
64 unresolved external symbol MPI_IMPROBE@20 msmpifms.lib
57 unresolved external symbol mpi_improbe@20 msmpifms.lib
58 unresolved external symbol mpi_improbe@20 msmpifms.lib
59 unresolved external symbol mpi_improbe@20 msmpifms.lib
60 unresolved external symbol mpi_improbe@20 msmpifms.lib
61 unresolved external symbol mpi_improbe@20 msmpifms.lib
62 unresolved external symbol mpi_improbe@20 msmpifms.lib
63 unresolved external symbol mpi_improbe@20 msmpifms.lib
66 unresolved external symbol mpi_improbe
@20 msmpifms.lib
93 unresolved external symbol _mpi_imrecv@20 msmpifms.lib
92 unresolved external symbol MPI_IMRECV@20 msmpifms.lib
85 unresolved external symbol mpi_imrecv@20 msmpifms.lib
86 unresolved external symbol mpi_imrecv@20 msmpifms.lib
87 unresolved external symbol mpi_imrecv@20 msmpifms.lib
88 unresolved external symbol mpi_imrecv@20 msmpifms.lib
89 unresolved external symbol mpi_imrecv@20 msmpifms.lib
90 unresolved external symbol mpi_imrecv@20 msmpifms.lib
91 unresolved external symbol mpi_imrecv@20 msmpifms.lib
94 unresolved external symbol mpi_imrecv
@20 msmpifms.lib
79 unresolved external symbol _mpi_mprobe@20 msmpifms.lib
78 unresolved external symbol MPI_MPROBE@20 msmpifms.lib
71 unresolved external symbol mpi_mprobe@20 msmpifms.lib
72 unresolved external symbol mpi_mprobe@20 msmpifms.lib
73 unresolved external symbol mpi_mprobe@20 msmpifms.lib
74 unresolved external symbol mpi_mprobe@20 msmpifms.lib
75 unresolved external symbol mpi_mprobe@20 msmpifms.lib
76 unresolved external symbol mpi_mprobe@20 msmpifms.lib
77 unresolved external symbol mpi_mprobe@20 msmpifms.lib
80 unresolved external symbol mpi_mprobe
@20 msmpifms.lib
107 unresolved external symbol _mpi_mrecv@20 msmpifms.lib
106 unresolved external symbol MPI_MRECV@20 msmpifms.lib
99 unresolved external symbol mpi_mrecv@20 msmpifms.lib
100 unresolved external symbol mpi_mrecv@20 msmpifms.lib
101 unresolved external symbol mpi_mrecv@20 msmpifms.lib
102 unresolved external symbol mpi_mrecv@20 msmpifms.lib
103 unresolved external symbol mpi_mrecv@20 msmpifms.lib
104 unresolved external symbol mpi_mrecv@20 msmpifms.lib
105 unresolved external symbol mpi_mrecv@20 msmpifms.lib
108 unresolved external symbol mpi_mrecv
@20 msmpifms.lib
149 unresolved external symbol _mpi_op_commutative@12 msmpifms.lib
148 unresolved external symbol MPI_OP_COMMUTATIVE@12 msmpifms.lib
141 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
142 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
143 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
144 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
145 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
146 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
147 unresolved external symbol mpi_op_commutative@12 msmpifms.lib
150 unresolved external symbol mpi_op_commutative
@12 msmpifms.lib
46 unresolved external symbol _MPI_RECV@36 referenced in function _MPICOMM_MOD_MPI_SEQMESSAGE@32 MPIComm_mod.obj
47 unresolved external symbol _MPI_SEND@32 referenced in function _MPICOMM_MOD_MPI_SEQMESSAGE@32 MPIComm_mod.obj
219 unresolved external symbol _mpi_status_set_elements_x@20 msmpifms.lib
218 unresolved external symbol MPI_STATUS_SET_ELEMENTS_X@20 msmpifms.lib
211 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
212 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
213 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
214 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
215 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
216 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
217 unresolved external symbol mpi_status_set_elements_x@20 msmpifms.lib
220 unresolved external symbol mpi_status_set_elements_x
@20 msmpifms.lib
233 unresolved external symbol _mpi_type_get_extent_x@24 msmpifms.lib
232 unresolved external symbol MPI_TYPE_GET_EXTENT_X@24 msmpifms.lib
225 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
226 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
227 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
228 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
229 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
230 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
231 unresolved external symbol mpi_type_get_extent_x@24 msmpifms.lib
234 unresolved external symbol mpi_type_get_extent_x
@24 msmpifms.lib
247 unresolved external symbol _mpi_type_get_true_extent_x@24 msmpifms.lib
246 unresolved external symbol MPI_TYPE_GET_TRUE_EXTENT_X@24 msmpifms.lib
239 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
240 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
241 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
242 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
243 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
244 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
245 unresolved external symbol mpi_type_get_true_extent_x@24 msmpifms.lib
248 unresolved external symbol mpi_type_get_true_extent_x
@24 msmpifms.lib
121 unresolved external symbol _mpi_type_size_x@16 msmpifms.lib
120 unresolved external symbol MPI_TYPE_SIZE_X@16 msmpifms.lib
113 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
114 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
115 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
116 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
117 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
118 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
119 unresolved external symbol mpi_type_size_x@16 msmpifms.lib
122 unresolved external symbol mpi_type_size_x
@16 msmpifms.lib
210 unresolved external symbol _pm msmpifms.lib
208 unresolved external symbol _pmpi_dist_graph_create@56 msmpifms.lib
207 unresolved external symbol _PMPI_DIST_GRAPH_CREATE@56 msmpifms.lib
209 unresolved external symbol pmpi_dist_graph_create@56 msmpifms.lib
194 unresolved external symbol _pmpi_dist_graph_create_adjacent@60 msmpifms.lib
193 unresolved external symbol PMPI_DIST_GRAPH_CREATE_ADJACENT@60 msmpifms.lib
195 unresolved external symbol pmpi_dist_graph_create_adjacent@60 msmpifms.lib
196 unresolved external symbol pmpi_dist_graph_create_adjacent
@60 msmpifms.lib
180 unresolved external symbol pmpi_dist_graph_neighbors@44 msmpifms.lib
179 unresolved external symbol PMPI_DIST_GRAPH_NEIGHBORS@44 msmpifms.lib
181 unresolved external symbol pmpi_dist_graph_neighbors@44 msmpifms.lib
168 unresolved external symbol pmpi_dist_graph_neighbors
@28 msmpifms.lib
182 unresolved external symbol pmpi_dist_graph_neighbors
@44 msmpifms.lib
166 unresolved external symbol _pmpi_dist_graph_neighbors_count@28 msmpifms.lib
165 unresolved external symbol _PMPI_DIST_GRAPH_NEIGHBORS_COUNT@28 msmpifms.lib
167 unresolved external symbol pmpi_dist_graph_neighbors_count@28 msmpifms.lib
138 unresolved external symbol _pmpi_get_elements_x@20 msmpifms.lib
137 unresolved external symbol PMPI_GET_ELEMENTS_X@20 msmpifms.lib
139 unresolved external symbol pmpi_get_elements_x@20 msmpifms.lib
140 unresolved external symbol pmpi_get_elements_x
@20 msmpifms.lib
68 unresolved external symbol _pmpi_improbe@20 msmpifms.lib
67 unresolved external symbol PMPI_IMPROBE@20 msmpifms.lib
69 unresolved external symbol pmpi_improbe@20 msmpifms.lib
70 unresolved external symbol pmpi_improbe
@20 msmpifms.lib
96 unresolved external symbol _pmpi_imrecv@20 msmpifms.lib
95 unresolved external symbol PMPI_IMRECV@20 msmpifms.lib
97 unresolved external symbol pmpi_imrecv@20 msmpifms.lib
98 unresolved external symbol pmpi_imrecv
@20 msmpifms.lib
82 unresolved external symbol _pmpi_mprobe@20 msmpifms.lib
81 unresolved external symbol PMPI_MPROBE@20 msmpifms.lib
83 unresolved external symbol pmpi_mprobe@20 msmpifms.lib
84 unresolved external symbol pmpi_mprobe
@20 msmpifms.lib
110 unresolved external symbol _pmpi_mrecv@20 msmpifms.lib
109 unresolved external symbol PMPI_MRECV@20 msmpifms.lib
111 unresolved external symbol pmpi_mrecv@20 msmpifms.lib
112 unresolved external symbol pmpi_mrecv
@20 msmpifms.lib
152 unresolved external symbol _pmpi_op_commutative@12 msmpifms.lib
151 unresolved external symbol PMPI_OP_COMMUTATIVE@12 msmpifms.lib
153 unresolved external symbol pmpi_op_commutative@12 msmpifms.lib
154 unresolved external symbol pmpi_op_commutative
@12 msmpifms.lib
222 unresolved external symbol _pmpi_status_set_elements_x@20 msmpifms.lib
221 unresolved external symbol PMPI_STATUS_SET_ELEMENTS_X@20 msmpifms.lib
223 unresolved external symbol pmpi_status_set_elements_x@20 msmpifms.lib
224 unresolved external symbol pmpi_status_set_elements_x
@20 msmpifms.lib
236 unresolved external symbol _pmpi_type_get_extent_x@24 msmpifms.lib
235 unresolved external symbol PMPI_TYPE_GET_EXTENT_X@24 msmpifms.lib
237 unresolved external symbol pmpi_type_get_extent_x@24 msmpifms.lib
238 unresolved external symbol pmpi_type_get_extent_x
@24 msmpifms.lib
250 unresolved external symbol _pmpi_type_get_true_extent_x@24 msmpifms.lib
249 unresolved external symbol PMPI_TYPE_GET_TRUE_EXTENT_X@24 msmpifms.lib
251 unresolved external symbol pmpi_type_get_true_extent_x@24 msmpifms.lib
252 unresolved external symbol pmpi_type_get_true_extent_x
@24 msmpifms.lib
124 unresolved external symbol _pmpi_type_size_x@16 msmpifms.lib
123 unresolved external symbol PMPI_TYPE_SIZE_X@16 msmpifms.lib
125 unresolved external symbol pmpi_type_size_x@16 msmpifms.lib
126 unresolved external symbol pmpi_type_size_x
@16 msmpifms.lib

What should I do?

It’s really tough to move a commercial code from one environment to another.

Hi CNJ,

For question #1, I’ll refer you to chapter 7 of the PGI Compiler Reference Guide which details the various Windows interface modules.

For “hostnm” and “getlog”, these are included in DFPORT so adding “use dfport” to the routines that uses these intrinsics should get the correct routine calls. Without the “use”, implicit declaration is most likely being used and why you’re not getting the correct symbol names.

We don’t support “changedirqq” but you should be able to use the DFPORT “chdir” intrinsic instead.


For question #2, we ship MS-MPI with the compilers so you don’t need to install you’re own. If you are using PGI Workstation, add the flag “-Mmpi=msmpi”. This will automatically add any include and library directories as well as all needed libraries to the link line.

For PVF, there’s a property box where you can say to compile using MS-MPI. Please see chapter 4 of the PVF Users guide for details.

I suspect what’s happening here is that you aren’t including the correct “mpi.h” file or using the correct MPI module. If you aren’t using either, make sure to add “use mpi” to your routines so the proper interface module can be used.

Hope this helps,
Mat

For Q1,

I’m already using DFPORT and that message comes out.

In case of chdir, I will try it. Thank you for the tip.

Since changedirqq returns logical value and chdir returns integer value, I only need to add a few lines to transfer integer to logical appropriately, right?

For Q2,

If I do that without installing MS-MPI, the compiler gives error that it can’t open msmpifms.lib.

So if I install MS-MPI on my own, those errors are the results.

What’s interesting is that if I use files in Microsoft HPC 2012 Pack Redistributable instead of those in Microsoft MPI v7, all errors except following three vanish:

46 unresolved external symbol _MPI_RECV@36 referenced in function _MPICOMM_MOD_MPI_SEQMESSAGE@32 MPIComm_mod.obj
47 unresolved external symbol _MPI_SEND@32 referenced in function _MPICOMM_MOD_MPI_SEQMESSAGE@32 MPIComm_mod.obj
45 unresolved external symbol _MPI_BCAST@28 referenced in function _MPICOMM_MOD_GETMPIFILE@16 MPIComm_mod.obj

What’s the matter with Microsoft MPI library? Why the HPC pack works while the MS-MPI doesn’t work? And how should I fix those three errors then?

I will post the subroutines that cause troubles.

If not enough, please tell me.

Sorry that I can’t respond fast because of 16-hour time difference between my country and USA Eastern Standard Time.

SUBROUTINE MPI_SeqMessage(mesg0, io, ltime, ldisp, myrank, NPROC, COMM)
USE PARAM
USE IOUTIL,   ONLY : message
IMPLICIT NONE
CHARACTER(132) :: mesg0
INTEGER :: IO, MYRANK, COMM, nproc
LOGICAL :: ltime, ldisp
INTEGER :: i, ierr, istatus(MPI_STATUS_SIZE)

IF(myrank .EQ. 0) THEN
  CALL message(io, ltime, ldisp, mesg0)
  DO i = 1, nproc-1
    CALL MPI_RECV(mesg(1:132), 132, MPI_CHARACTER, i, 2, comm, istatus, ierr)
    mesg(14:132) = mesg(1:119); mesg(1:13) =''
    CALL message(io, false, ldisp, mesg)
    
  ENDDO
ELSE
  CALL MPI_SEND(mesg0(1:132), 132, MPI_CHARACTER, 0, 2, comm, ierr)
ENDIF
CALL MPI_SYNC(Comm)
END SUBROUTINE



SUBROUTINE GetMPIFile(Dat, Master, comm)
IMPLICIT NONE
CHARACTER(80) :: Dat 
LOGICAL :: Master
INTEGER:: comm, ierr
REAL(8) :: Tbeg, Tend

tbeg = nTracer_dclock(.false., .false.)

CALL MPI_BCAST(DAT, 80, MPI_CHARACTER, 0, comm, ierr)

tend = nTracer_dclock(.false., .false.)
TimeChk%CommTime = TimeChk%CommTime + tend - tbeg

END SUBROUTINE

These subroutines are all contained in a module and at the top line of the module I stated ‘USE MPI’

Hi CNJ,

Can you try running the example MPI tests we ship with the compilers?

You can find them in “$PGI/win32/2015/examples/MPI” and “$PGI/win64/2015/examples/MPI”.

Type “make NPROCS=4 mpihello_test” to build and run.

  • Mat

My product is PGI Visual Fortran 15.10 for win32 and I can’t see that folder.

What about DFPORT problem?

I fixed changedirqq to chdir, but the remaining two (hostnm, getlog) doesn’t work.

What about DFPORT problem?

I tried calling these and get the same undefined reference error. I added a problem report, TPR#22276, and sent it on to engineering for further investigation.

  • Mat

We’ve been reviewing old TPRs and have decided to not implement “hostnm” and “getlog”, so I’m closing this task.